Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 1.09 KB

File metadata and controls

15 lines (12 loc) · 1.09 KB

Server sent events

This example shows how to integrate an SSE server and Temporal in a simple workflow.

Running this sample

  1. temporal server start-dev to start Temporal Server.
  2. npm install to install dependencies.
  3. npm run server to start the server.
  4. PORT=3001 npm run server to start yet another server in another port.
  5. In another shell, connect to the first server with curl localhost:3000/events?room_id=A.
  6. In yet another shell, connect to the second server (note port 3001) with curl localhost:3001/events?room_id=A.
  7. In yet another shell, connect to the first server with curl localhost:3000/events?room_id=B.
  8. In yet another shell, send a message to room A: curl -XPOST "localhost:3000/events?room_id=A&message=Hi%20room%20A". This message will be broadcasted to your first and second shells, even though they are connected through different servers!
  9. Now, send a message to room B: curl -XPOST "localhost:3000/events?room_id=B&message=Hi%20room%20B". You should now only see a message pop up in the last shell!