Testing WebSocket Events
event command includes the
start-websocket-server subcommand that starts a mock WebSocket server that you can use to test your client.
To use this command, you must first implement a WebSocket client that handles the server’s messages. For details, see Getting Events Using WebSockets.
Starting the server
start-websocket-server subcommand to starts a mock WebSocket server that you use to test your client. In a terminal window, enter:
twitch event start-websocket-server
To end the server, enter
Connecting to the server
The URI that you use in your client code to connect your client to the server is:
The messages that the server sends
After connecting your client to the server, the server sends the client a welcome message followed by ping and keepalive messages. To receive a reconnect message, use the
--reconnect flag (see below).
Flags to use with the server
Use these flags to change the server’s behavior or send additional messages.
|--reconnect||-r||Use to ask the mock server to send a reconnect message. The syntax is
|--port||-p||Use to specify the port number to use in the localhost address. The syntax is