Skip to content

pusher endpoint updated, cluster support added #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ using namespace std;
void cn_ev(const pushcpp::ConnectionEvent ev);
void er_ev(const int code, const std::string &msg);

pushcpp pp("my-api-key", cn_ev, er_ev);
pushcpp pp("my-app-key", "eu", cn_ev, er_ev);

void cn_ev(const pushcpp::ConnectionEvent ev)
{
printf("ConnectEvent: %d\n", ev);
pp.send("channel", "pusher:subscribe", "lol");
//pp.send("channel", "pusher:subscribe", "lol");
}

void er_ev(const int code, const std::string &msg)
Expand Down Expand Up @@ -46,7 +46,7 @@ void sub_ev(

// for (auto it = ChannelData

pp.unsubscribe(channel);
// pp.unsubscribe(channel);

cd = pp.subscriptions();

Expand All @@ -67,7 +67,7 @@ void sub_ev(

int main()
{
pp.subscribe("my_channel", sub_ev);
pp.subscribe("my-channel", sub_ev);

pp.connect();

Expand Down
3 changes: 2 additions & 1 deletion pushcpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

pushcpp::pushcpp(
const string &appKey,
const string &cluster,
ConnectionEventHandler ch,
ErrorEventHandler eh
)
{
this->m_connectionEventHandler = ch;
this->m_errorEventHandler = eh;
stringstream str;
str << "ws://ws.pusherapp.com:80/app/";
str << "ws://ws-" << cluster << ".pusher.com:80/app/";
str << appKey;
str << "?client=pushcpp&version=1.0&protocol=5";
m_url = str.str();
Expand Down
1 change: 1 addition & 0 deletions pushcpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class pushcpp
*/
pushcpp(
const std::string &appKey,
const std::string &cluster,
ConnectionEventHandler ch = NULL,
ErrorEventHandler eh = NULL
);
Expand Down