-
Notifications
You must be signed in to change notification settings - Fork 815
Web Socket
Clients are recommended to connect to the server's web socket in order to receive notifications of various system events, which can help reduce the need to repeatedly poll for data through the http api.
Make a call to /System/Info. WebSocketPortNumber is the port hosting the web socket. From there the connection url is:
ws://hostname:{websocketport}/mediabrowser
All messages sent and received over the web socket are in the format of a json structure:
{ MessageType: "RestartRequired", Data: "" }
MessageType is the name of the event or action, Data is any related data. Data can be plain text, or a json structure itself, depending on MessageType.
As soon as the connection is established, an identification message should be sent by the client which includes the client name, device id, application version and device name. For example
` {
MessageType: "Identity",
Data: "Dashboard|df787898fdsf7ds80|1.0.0.0|nexus7"
} `
The client name must match the value used in http authorization headers.
Once connected and identified, you'll be able to receive the following MessageTypes from the web socket:
See below section on commands.
A user changed their personal rating for an item, or their playstate was updated. Data = a json object with the following properties:
- UserId
- UserDataList - a list of updated user data objects
Data = the user id that has been deleted
Data = the user object that has been updated
A user has marked notifications read. Presentations should refresh their notification list.
A user has marked notifications read. Presentations should refresh their notification list.
A user has marked notifications read. Presentations should refresh their notification list.
This indicates the server needs to be restarted. There is no data associated with this.
This will tell you when the server is restarting or shutting down.
A remote control play command has been sent from the server. Data = a json object with the following properties:
- ItemIds - an array of item id's to play
- PlayCommand - PlayNow, PlayNext or PlayLast
- StartPositionTicks - If supplied, this is the position in which the first title should start at.
A remote control update playstate command has been sent from the server. Data = a json object with the following properties:
- Command - Stop, Pause, Unpause, NextTrack, PreviousTrack, Seek
- SeekPositionTicks - Used with the seek command.
Most remote control commands are implemented in a pass-through fashion. That is the server simply takes the command and passes it directly to the client without modification.
The standard web socket message format is utilized. The Data property is an object describing the remote control command. The command will have two properties:
Name Arguments.
Below are the list of known core commands, along with the list of properties available in Arguments.
- MoveUp = 0,
- MoveDown = 1,
- MoveLeft = 2,
- MoveRight = 3,
- PageUp = 4,
- PageDown = 5,
- PreviousLetter = 6,
- NextLetter = 7,
- ToggleOsd = 8,
- ToggleContextMenu = 9,
- Select = 10,
- Back = 11,
- TakeScreenshot = 12,
- SendKey = 13,
- SendString = 14,
- GoHome = 15,
- GoToSettings = 16,
- VolumeUp = 17,
- VolumeDown = 18,
- Mute = 19,
- Unmute = 20,
- ToggleMute = 21,
- SetVolume = 22,
- SetAudioStreamIndex = 23,
- SetSubtitleStreamIndex = 24,
- ToggleFullscreen = 25,
- DisplayContent = 26,
- GoToSearch = 27,
- DisplayMessage = 28
Playback check-ins can also be sent over the web socket, allowing the client to send them more often due to the reduced overhead.
See the playback check-in article.
Emby Home | Latest News | Emby Downloads | Emby Community Forums | © 2019 Emby LLC
- Locating the Server
- Emby Connect
- Browsing the Library
- Latest Items
- Item Information
- Item Types
- Images
- Items by Name
- Web Socket
- Remote Control
- Live TV
- Playlists
- Parental Control
- Filtering
- Sync
- Playback Guidelines
- Audio Streaming
- Video Streaming
- HTTP Live Streaming (HLS)
- Subtitles
- Playback Check-ins