Real time chat? Websockets? #937
|
Hello everyone, Does anyone have advice on how to implement real-time chat functionality within a Hyperview project without a React Native chat component? I’m considering the following approach:
I think this would work if I figured out how to set up a WebSocket with an append action. Thanks in advance for any suggestions or examples! |
Replies: 1 comment
Hi @grahamseamans , I don't have direct experience with WebSockets in Hyperview. However, a while ago I did try to add support for Server-Sent Events (SSE). Though it didn't make it to the released version (needs more thought), the prototyped approach worked quite well. You can see the design and the example XML in a branch here: master...adam/event-source The relevant parts are:
Essentially, this allows the server to send real-time events that trigger behaviors in the client. The client can reply to those events by requesting new content from the server (like you said, potentially appending new messages to your UI). I think this approach can work with WebSockets as well. Even though it requires a second request to the server, in practice I found this cleaner than trying to send XML in realtime, so I suggest you start there. Let me know if you have any questions about the proposed approach! We are interested in real-time support in Hyperview (SSE and Websockets), so if you get something working we could consider adding it to the framework. |
Hi @grahamseamans , I don't have direct experience with WebSockets in Hyperview. However, a while ago I did try to add support for Server-Sent Events (SSE). Though it didn't make it to the released version (needs more thought), the prototyped approach worked quite well. You can see the design and the example XML in a branch here: master...adam/event-source
The relevant parts are:
event-sourceto configure receiving the real-time …