Skip to content
This repository has been archived by the owner on Jul 13, 2019. It is now read-only.

edgurgel/pusher_client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PusherClient Build Status

Websocket client to Pusher service

Usage

iex> {:ok, pid} = PusherClient.start_link("ws://localhost:8080", "app_key", "secret", stream_to: self)
{:ok, #PID<0.134.0>}
iex> PusherClient.subscribe!(pid, "channel")
:ok
iex> PusherClient.subscribe!(pid, "presence-channel", %PusherClient.User{id: "123", info: %{a: "b"}})
:ok
# self will receive messages like this:
%{channel: nil,
  data: %{"activity_timeout" => 120,
    "socket_id" => "b388664a-3278-11e4-90df-7831c1bf9520"},
  event: "pusher:connection_established"}

%{channel: "channel", data: %{}, event: "pusher:subscription_succeeded"}

That's it!

You can disconnect too:

iex> PusherClient.disconnect!(pid)
:stop

About

A websocket client to work with Pusher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages