summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/nlopes/slack/websocket.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/nlopes/slack/websocket.go')
-rw-r--r--vendor/github.com/nlopes/slack/websocket.go32
1 files changed, 16 insertions, 16 deletions
diff --git a/vendor/github.com/nlopes/slack/websocket.go b/vendor/github.com/nlopes/slack/websocket.go
index 6eb09263..f3c9cbd8 100644
--- a/vendor/github.com/nlopes/slack/websocket.go
+++ b/vendor/github.com/nlopes/slack/websocket.go
@@ -17,7 +17,7 @@ const (
// RTM represents a managed websocket connection. It also supports
// all the methods of the `Client` type.
//
-// Create this element with Client's NewRTM().
+// Create this element with Client's NewRTM() or NewRTMWithOptions(*RTMOptions)
type RTM struct {
idGen IDGenerator
pings map[int]time.Time
@@ -38,23 +38,23 @@ type RTM struct {
// UserDetails upon connection
info *Info
+
+ // useRTMStart should be set to true if you want to use
+ // rtm.start to connect to Slack, otherwise it will use
+ // rtm.connect
+ useRTMStart bool
}
-// NewRTM returns a RTM, which provides a fully managed connection to
-// Slack's websocket-based Real-Time Messaging protocol.
-func newRTM(api *Client) *RTM {
- return &RTM{
- Client: *api,
- IncomingEvents: make(chan RTMEvent, 50),
- outgoingMessages: make(chan OutgoingMessage, 20),
- pings: make(map[int]time.Time),
- isConnected: false,
- wasIntentional: true,
- killChannel: make(chan bool),
- forcePing: make(chan bool),
- rawEvents: make(chan json.RawMessage),
- idGen: NewSafeID(1),
- }
+// RTMOptions allows configuration of various options available for RTM messaging
+//
+// This structure will evolve in time so please make sure you are always using the
+// named keys for every entry available as per Go 1 compatibility promise adding fields
+// to this structure should not be considered a breaking change.
+type RTMOptions struct {
+ // UseRTMStart set to true in order to use rtm.start or false to use rtm.connect
+ // As of 11th July 2017 you should prefer setting this to false, see:
+ // https://api.slack.com/changelog/2017-04-start-using-rtm-connect-and-stop-using-rtm-start
+ UseRTMStart bool
}
// Disconnect and wait, blocking until a successful disconnection.