Connection Methods
Pokémon Showdown is implemented using SockJS, a compatibility layer over raw WebSocket. You can connect directly using WebSocket:Protocol Structure
Client-to-Server
Messages sent from clients to the server follow a simple
ROOMID|TEXT formatServer-to-Client
Messages from the server include room identifiers and pipe-delimited data blocks
Battle Protocol
Battle-specific messages use a specialized format for game state updates
Choice Requests
JSON-based requests for player decisions during battles
Message Format Basics
Server Messages
Server-to-client messages follow this structure:The
>ROOMID line can be omitted if the room is lobby or global. Empty lines should be ignored.| and follow the pattern:
Client Messages
Messages from clients to the server use:ROOMID can be left blank if unneeded. Responses will be sent to a PM box with no username.TEXT can contain newlines, which will be treated as if each line were sent separately.
Message Type Abbreviations
For bandwidth efficiency, five common message types are abbreviated:| Full Type | Abbreviated | Description |
|---|---|---|
chat | c | Chat messages |
join | j | User joined |
leave | l | User left |
name | n | Name change |
battle | b | Battle started |
Example Message Flow
Here’s what a typical chat room interaction looks like:Debugging
The official client logs protocol messages in the JavaScript console (F12 in most browsers), which helps understand what’s happening during gameplay.Client Implementations
Reference implementations are available in multiple languages:Official Client
HTML5 + JavaScript implementationView on GitHub
Android Client
Kotlin/Java implementation by MajeurView on GitHub
Node.js Bot
Chat bot by Quinella and TalkTakesTimeView on GitHub
Ruby Bot
Chat bot by pickdenisView on GitHub
Next Steps
Client-Server Messages
Learn about room messages, authentication, and server commands
Battle Protocol
Understand battle-specific messages and game state updates
Choice Requests
Handle player decisions and move selections
