-
-
Notifications
You must be signed in to change notification settings - Fork 497
Closed
1 / 11 of 1 issue completed
Copy link
Labels
Documentation 📚This is related to documentationThis is related to documentation
Description
Description
I am trying the example , and it is not working. I had drill down to included MVCE and i believe connection_lifespan is the culprit.
URL to code causing the issue
MCVE
import asyncio
import time
from typing import Any, AsyncGenerator
from litestar import Litestar, WebSocket, websocket_listener
from litestar.handlers import send_websocket_stream
async def listener_lifespan(socket: WebSocket) -> None:
pass
@websocket_listener("/", connection_lifespan=listener_lifespan)
def handler(socket: WebSocket, data: Any) -> None:
print(f"{socket.client}: {data}")
app = Litestar([handler])Steps to reproduce
- litestar run --reload -p 8881 --host=0.0.0.0
- websocat ws://localhost:8881
Screenshots
No response
Logs
INFO: ('127.0.0.1', 38680) - "WebSocket /" 403
INFO: connection rejected (403 Forbidden)
INFO: connection closed
websocat: WebSocketError: Connection refused (os error 111)
websocat: error running
(litestar-chat)
Litestar Version
Platform
- Linux
- Mac
- Windows
- Other (Please specify in the description above)
Sub-issues
Metadata
Metadata
Assignees
Labels
Documentation 📚This is related to documentationThis is related to documentation