Shape of Phoenix Channel socket messages

First “3” (0th position) Channel Id or topic Id which is maintained internal to the socket.

Second “3” (1st position) is the message id - this will be used in match request and response when a message is received. This is called refId

room:36 (2nd position) is the topic name or channel name

"phx_join" (3rd position) is the event name

"{}" is the payload or message received or sent.

Heartbeat won’t not have topic Id, but will have refId.

Push message from server on a channel wont have message id or refId. Below message is mostly server push.

I am recollecting from a C# implementation of channels I made.

I had written a event recorder and event player socket which extends base socket. Event recorder records time and message sent - all this is persisted in a json file. Event player socket will replay the messages with exact timing when it is initialised. We use this for testing, debugging and replaying player sessions.

3 Likes