This example shows how to integrate an SSE server and Temporal in a simple workflow.
temporal server start-devto start Temporal Server.npm installto install dependencies.npm run serverto start the server.PORT=3001 npm run serverto start yet another server in another port.- In another shell, connect to the first server with
curl localhost:3000/events?room_id=A. - In yet another shell, connect to the second server (note port 3001) with
curl localhost:3001/events?room_id=A. - In yet another shell, connect to the first server with
curl localhost:3000/events?room_id=B. - 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! - 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!