-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add SSE example #287
base: main
Are you sure you want to change the base?
add SSE example #287
Conversation
|
Great! Thanks @nubunto for contributing this sample. I think we really need to demonstrate this concept in a setup that supports the possibly of having more than one HTTP server running at the same time. The main difficulty in that case is that the activity task to send a message to user/connection X need to be routed to the appropriate activity worker, ie. the one that lives in the process that own that HTTP connection. Implementation wise, this is not very complex (per host task queue), but that requires that workflows sending messages knows the list of user/activity task queues to which they need post messages. What I have in mind would be to have something like a "Chat Room Workflow". When establish an SSE connection, the user would have to tell the name of the chat room it want to join (eg. to make it easy, that could be a segment of the URL). The HTTP handler add the connection to its local pool of SSE connection, then do What do you think? |
that was on the back of my mind as I finished and tested the implementation, and I think it's very reasonable! I'll update the PR accordingly as soon as I have the time! |
Another possible way of achieving the same end result of horizontally scaling the HTTP server is by leveraging something like Redis pub sub as a lightweight message broker. Usually this is not what I'd do if I'm going for durability, but since the message publishing is backed by Temporal it might be an relatively lightweight solution. |
@mjameswh I implemented your suggestion! took me a while, sorry about that. Please, take a look whenever possible and let me know what you think! |
Great! Will try to review by the end of this week. Thanks for your work on this. |
What was changed
Added a very simple SSE sample.
Why?
Seems like something people usually want to know how to work out.