Kraigie / nostrum

Elixir Discord Library
https://kraigie.github.io/nostrum/
MIT License
588 stars 125 forks source link

Docs update: manual sharding #603

Closed jb3 closed 1 month ago

jb3 commented 1 month ago
tignear commented 1 month ago

The disconnect/1 function returns a sequence (seq). Since the shard cannot deliver events occurring after this seq, the consumer will not receive those events. Moreover, the gateway will not send events occurring before the seq. Additionally, the session ID will be invalidated upon the first reconnection attempt, making it impossible to resume with the same session ID (though it may be possible by sending requests simultaneously). Consequently, events will not be delivered twice.

And Discord guarantees(I'm not sure if this can be called a guarantee.) that the session can be restarted for a few minutes.

If you simply close the TCP connection or use a different close code, the session will remain active and timeout after a few minutes. This can be useful when you're Resuming the previous session.

https://discord.com/developers/docs/topics/gateway#disconnecting

jchristgit commented 1 month ago

Thanks!