diff --git a/gateway/gateway.go b/gateway/gateway.go index 5662de1..76ae29a 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -171,13 +171,17 @@ func NewFromState(gatewayURL string, state State, opts *ws.GatewayOpts) *Gateway } gw := ws.NewGateway(ws.NewWebsocket(ws.NewCodec(OpUnmarshalers), gatewayURL), opts) - return &Gateway{ gateway: gw, state: state, } } +// Opts returns a copy of the gateway options that are being used. +func (g *Gateway) Opts() *ws.GatewayOpts { + return g.gateway.Opts() +} + // State returns a copy of the gateway's internal state. It panics if the // gateway is currently running. func (g *Gateway) State() State { diff --git a/utils/ws/gateway.go b/utils/ws/gateway.go index d5de4ba..077d833 100644 --- a/utils/ws/gateway.go +++ b/utils/ws/gateway.go @@ -159,6 +159,13 @@ func NewGateway(ws *Websocket, opts *GatewayOpts) *Gateway { } } +// Opts returns a copy of the gateway options. The options can only be changed +// during construction, so a copy is a must. +func (g *Gateway) Opts() *GatewayOpts { + cpy := g.opts + return &cpy +} + // Send is a function to send an Op payload to the Gateway. func (g *Gateway) Send(ctx context.Context, data Event) error { op := Op{