pusher-cpp icon indicating copy to clipboard operation
pusher-cpp copied to clipboard

Conntecting to a pusher-server with specific host, wsPort and wssport

Open s1r-mar71n opened this issue 7 years ago • 1 comments

Is it possible to connect to a specific server with this library?

I am trying to port a nodejs implementation in order to improve performance, and those are the required fields: apikey, encrypted, wsPort, wssPort, host.

s1r-mar71n avatar Sep 10 '18 12:09 s1r-mar71n

I apologise for not getting back to you earlier.

This library prefers to follow the pattern of the other SDKs by taking a parameter for the cluster and building the rest of the address from there, e.g.,: https://github.com/BenPope/pusher-cpp/blob/master/pusher%2B%2B/include/pusher%2B%2B/client.hpp#L47

I will note that TLS isn't implemented yet; unfortunately I never tested it, and due to the templated nature of the library, it requires a separate implementation that has more steps (the TLS handshake if I recall) to work with TLS.

One way to provide a clean API over TLS and non-TLS is to implement the TLS implementation as a sub-library (the way ASIO and Beast do) and then type-erase that with a constructor that can support encryption or not.

This isn't something I find a great deal of time to work on, it's currently more of a proof of concept of an implementation in C++ that can support concurrency and TLS for those that already know ASIO. PRs welcome, etc.

The plan was to continue to work on it. I have some ideas for a much higher level implementation that pushes the pub-sub model beyond server support and into subsets of the json response with a unified api. Well, dreams.

To be honest, I built this over a weekend, prior to joining Pusher, as a talking point for the interview; a C++ SDK hasn't had much interest in general and my spare time since has been more sparse than expected.

BenPope avatar Oct 03 '18 00:10 BenPope