Categorygithub.com/go-numb/pusher-websocket-go
modulepackage
0.0.0-20190410135830-3f1b78f80a5b
Repository: https://github.com/go-numb/pusher-websocket-go.git
Documentation: pkg.go.dev

# README

pusher-websocket-go

Go client (WebSocket) library for Pusher.

Status: Not currently recommended for production use. The code connects, receives messages, and reconnects on failure, but there are no tests, interfaces may change, and there are a few missing features (see todo list below).

Usage

Create a new client. It establishes a WebSocket connection and handles automatic reconnection.

client := pusher.New("<key>")

Subscribe to one or more Pusher channels. There is no need to wait for the client to connect before subscribing.

channel := pusher.Subscribe("<channel>")

To bind to events:

channel.bind("my-event", func(data interface{}){
  fmt.Println(data)
})

client.bind(func (channel string, event string, data interface{}) {
  fmt.Println(channel, event, data)
})

TODO

  • Read close code, adjust reconnect behaviour
  • Expose client connection state changes

# Functions

New creates a new Pusher client with given Pusher application key.
NewWithConfig allows creating a new Pusher client which connects to a custom endpoint.

# Variables

No description provided by the author

# Structs

No description provided by the author
Client responsibilities: * Connecting (via Connection) * Reconnecting on disconnect * Decoding and encoding events * Managing channel subscriptions .
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author