websocket get peers on the server
can you show an example of how to get websocket peers on the server solistart
15 Replies
on the server I can't get peers
FYI: The h3 documentation still states that websocket support requires the nightly build of h3.
Vinxi only uses the standard v1.11.1 so full WS support may not be available yet.
Just a thought.
Try setting overrides/resolutions to
npm:h3-nightly@latest
and see if that has an effect (one way or another).GitHub
GitHub - pi0/nuxt-chat: A simple chat app made with Nuxt, Nitro Tas...
A simple chat app made with Nuxt, Nitro Tasks, Databases and Websockets! - pi0/nuxt-chat
I created a repo: https://github.com/peerreynders/solid-start-ws-demo
GitHub
GitHub - peerreynders/solid-start-ws-demo: Use a websocket server w...
Use a websocket server within SolidStart v1.0.0-rc.0 - peerreynders/solid-start-ws-demo
Thanks, I'll try
in your example from the solistart server I will not be able to send data to clients.
Should we wait for the official release of ws with solidstart?
If you look at the nuxt-chat example it's a matter of collecting the user/peers in a Map during the open event and removing them on the close event.
Then the server can send a message to anyone stored in the map at any time.
In the spirit of Plan to throw one away I'd use the opportunity to move ahead to figure out what you want to do and need.
Once websocket support stabilizes it should be relatively quick to switch over.
If you are only concerned with the server communicating with the client you could use SSE instead (which is part of the HTTP standard; websockets are not.)
https://youtu.be/n9mRjkQg3VE
GitHub
nuxt-chat/server/api/chat-ws.ts at main · pi0/nuxt-chat
A simple chat app made with Nuxt, Nitro Tasks, Databases and Websockets! - pi0/nuxt-chat
Plan to Throw One Away
Notes for Northeastern University CS 5500
GitHub
nitro-sse-counter/src/server/event-stream.ts at main · peerreynders...
SSE POC with UnJS Nitro and a TS JSDoc frontend. Contribute to peerreynders/nitro-sse-counter development by creating an account on GitHub.
Fest Group
YouTube
SSE vs WebSockets vs Long Polling. Martin Chaov. JS Fest 2018
The talk from JS Fest conference in Kyiv, Ukraine.
If you have a huge amount of data to deliver quickly you might have tried using web sockets to do so. However, sockets are hard to maintain and scale, not to mention multiplex. In this presentation I do a comparison of the three methods of delivering data to the front-end. Server-Sent Events gi...
i can use sse to reset cache for all users using server ?
I'm not understanding the question.
Each client has a separate SSE response responsible for streaming any events from the server to the respective client but the server side code has access to centrally managed server resources/services while the response remains open.
So the server can broadcast an event to all currently active event streams and each connected client can then take the necessary actions based on that event.
I want to send information to all clients
GitHub
GitHub - peerreynders/solid-start-sse-counter: Workaround demonstra...
Workaround demonstration for server side clean up after client closes EventSource - peerreynders/solid-start-sse-counter
is this example relevant?
This one would be more relevant
https://github.com/peerreynders/solid-start-sse-chat
but it hasn't been updated yet from the Beta 1 (0.2.26) days.
GitHub
GitHub - peerreynders/solid-start-sse-chat: Basic Chat demonstratio...
Basic Chat demonstration with server-sent events (SSE) - peerreynders/solid-start-sse-chat
thank you, I'll see when I have time
Now updated to SolidStart v1.0.0-rc.0
https://github.com/peerreynders/solid-start-sse-chat
GitHub
GitHub - peerreynders/solid-start-sse-chat: Basic Chat demonstratio...
Basic Chat demonstration with server-sent events (SSE) - peerreynders/solid-start-sse-chat