[][src]Function screeps_api::websocket::commands::subscribe

pub fn subscribe(channel: &Channel) -> String

Gets the raw websocket string to send for subscribing to a channel.

Subscribing to a channel you are already subscribed to may have differing results depending on the server software (official vs. private). Note that if you subscribe multiple times, it may be necessary to unsubscribe at least that many times to fully unsubscribe.

Subscribing multiple times may or may not result in duplicated messages, and may or may not result in extra initial messages.

It's recommended that you keep track of what channels you are subscribed to separately: this is tracked by the server, but is not tracked by screeps-api, and cannot be queried from the server.