Skip to content

pusher-community/pusher-websocket-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Go client library [[not production-ready]]

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages