You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: API.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
## API
2
2
### *Overview*
3
-
There're just 3 roles in this library - `socket`,`client` and `message`.
3
+
There're just 3 roles in this library - `socket`,`client` and `message`.
4
4
5
-
`client` is for physical connection while `socket` is for "namespace"(which is like a logical channel), which means one `socket` paired with one namespace, and one `client` paired with one physical connection.
5
+
`client` is for physical connection while `socket` is for "namespace"(which is like a logical channel), which means one `socket` paired with one namespace, and one `client` paired with one physical connection.
6
6
7
-
Since a physical connection can have multiple namespaces (which is called multiplex), a `client` object may have multiple `socket` objects, each is bind to a distinct `namespace`.
7
+
Since a physical connection can have multiple namespaces (which is called multiplex), a `client` object may have multiple `socket` objects, each of which is bound to a distinct `namespace`.
8
8
9
9
Use `client` to setup the connection to the server, manange the connection status, also session id for the connection.
10
10
11
11
Use `socket` to send messages under namespace and receives messages in the namespace, also handle special types of message.
12
12
13
-
The `message` is just about the content you want to send, with text,binary or structured combinations.
13
+
The `message` is just about the content you want to send, with text,binary or structured combinations.
14
14
15
15
### *Socket*
16
16
#### Constructors
@@ -28,7 +28,7 @@ Universal event emition interface, by applying implicit conversion magic, it is
Bind a callback to specified event name. Same as `socket.on()` function in JS, `event_listener` is for full content event object,`event_listener_aux` is for convinience.
31
+
Bind a callback to specified event name. Same as `socket.on()` function in JS, `event_listener` is for full content event object,`event_listener_aux` is for convenience.
32
32
33
33
`void off(std::string const& event_name)`
34
34
@@ -132,7 +132,7 @@ Set listener for socket close event, called when any sockets being closed, after
132
132
#### Connect and Close
133
133
`void connect(const std::string& uri)`
134
134
135
-
Connect to socket.io server, eg.`client.connect("ws://localhost:3000");`
135
+
Connect to socket.io server, e.g.,`client.connect("ws://localhost:3000");`
0 commit comments