Struct dasi::Connection
[−]
[src]
pub struct Connection { // some fields omitted }
Websocket connection to the Discord servers.
Methods
impl Connection
fn new(base_url: &str, token: &str) -> Result<(Connection, ReadyEvent)>
Establish a connection to the Discord websocket servers.
Returns both the Connection
and the ReadyEvent
which is always the
first event received and contains initial state information.
Usually called internally by Discord::connect
, which provides both
the token and URL.
fn set_game(&self, game: Option<Game>)
Change the game information that this client reports as playing.
fn set_game_name(&self, name: String)
Set the client to be playing this game, with defaults used for any extended information.
fn recv_event(&mut self) -> Result<Event>
Receive an event over the websocket, blocking until one is available.
fn shutdown(self) -> Result<()>
Cleanly shut down the websocket connection. Optional.