diff --git a/example.cpp b/example.cpp index 89c4359..1eb9b4e 100644 --- a/example.cpp +++ b/example.cpp @@ -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) @@ -46,7 +46,7 @@ void sub_ev( // for (auto it = ChannelData - pp.unsubscribe(channel); + // pp.unsubscribe(channel); cd = pp.subscriptions(); @@ -67,7 +67,7 @@ void sub_ev( int main() { - pp.subscribe("my_channel", sub_ev); + pp.subscribe("my-channel", sub_ev); pp.connect(); diff --git a/pushcpp.cpp b/pushcpp.cpp index ef77410..48c40c9 100644 --- a/pushcpp.cpp +++ b/pushcpp.cpp @@ -2,6 +2,7 @@ pushcpp::pushcpp( const string &appKey, + const string &cluster, ConnectionEventHandler ch, ErrorEventHandler eh ) @@ -9,7 +10,7 @@ pushcpp::pushcpp( 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(); diff --git a/pushcpp.h b/pushcpp.h index 4d80bc7..3d1f262 100644 --- a/pushcpp.h +++ b/pushcpp.h @@ -75,6 +75,7 @@ class pushcpp */ pushcpp( const std::string &appKey, + const std::string &cluster, ConnectionEventHandler ch = NULL, ErrorEventHandler eh = NULL );