Skip to content

Commit

Permalink
merge socketio#137: In TLS build of library, support both TLS and non…
Browse files Browse the repository at this point in the history
…-TLS connections.

The choice is made at runtime, if a TLS URI (https:// or wss://) is
given, the TLS client will be used, otherwise the non-TLS client will be
used.

Additionally, a new constructor is introduced allowing the URI to be
passed at construction, which allows the above selection to occur,
otherwise only the default for the library (TLS or non-TLS) will be used
(preserving the original behavior).
  • Loading branch information
cqm committed Oct 16, 2018
1 parent b4987f9 commit 6a24763
Show file tree
Hide file tree
Showing 7 changed files with 299 additions and 118 deletions.
14 changes: 14 additions & 0 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ Get current namespace name which the client is inside.
#### Constructors
`client()` default constructor.

`client(const std::string& uri)`

Constructor with URI. This form of the constructor will select automatically
between TLS and non-TLS versions of the client if you are linking with the
TLS build. To use TLS, provide a URI with the `https://` or `wss://` scheme,
otherwise use 'http://' or 'ws://'. If an unsupported scheme is given, an
exception will be thrown.

After constructing with this URI, you may call `connect()` with no arguments.

#### Connection Listeners
`void set_open_listener(con_listener const& l)`

Expand Down Expand Up @@ -130,6 +140,10 @@ Set listener for socket close event, called when any sockets being closed, after
```

#### Connect and Close
`void connect()`

Connect to socket.io server URI previously given to the constructor.

`void connect(const std::string& uri)`

Connect to socket.io server, e.g., `client.connect("ws://localhost:3000");`
Expand Down
Loading

0 comments on commit 6a24763

Please sign in to comment.