`WebSocketEndpoint`
See original GitHub issueProvide a class-based websocket handler.
from starlette.endpoints import WebSocketEndpoint
class App(WebSocketEndpoint):
async def on_connect(self, websocket, **kwargs):
...
async def on_receive(self, websocket, data):
...
async def on_disconnect(self, websocket):
...
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:17 (16 by maintainers)
Top Results From Across the Web
Endpoints - Starlette
The WebSocketEndpoint class is an ASGI application that presents a wrapper around the functionality of a WebSocket instance. The ASGI connection scope is ......
Read more >Endpoint (Java(TM) EE 7 Specification APIs)
The Web Socket Endpoint represents an object that can handle websocket conversations. Developers may extend this class in order to implement a programmatic ......
Read more >WebsocketEndpoint (Jakarta Server Fages API documentation)
This web socket server endpoint handles web socket requests coming from <f:websocket> . Since: 2.3; Author: Bauke Scholtz; See Also ...
Read more >WebSocketEndPoint (CometD :: Java 4.0.9 API)
public class WebSocketEndPoint extends javax.websocket.Endpoint implements javax.websocket.MessageHandler.Whole<String> ...
Read more >starlette/endpoints.py at master · encode/starlette - GitHub
class WebSocketEndpoint: encoding: typing.Optional[str] = None # May be "text", "bytes", or "json". def __init__(self, scope: Scope, receive: Receive, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve started on an implementation for this, it appears to work as expected in my test application. I’m happy to open a PR with tests, documentation, etc. after getting some feedback here.
How does this look so far?
Does this work? im having trouble with " RuntimeError: Unexpected ASGI message ‘websocket.send’, after sending ‘websocket.close’."