@@ -12,6 +12,7 @@ By virtue of being written in C++, this client works in several different platfo
12
12
- Compatible with 1.0+ protocol
13
13
- Binary support
14
14
- Automatic JSON encoding
15
+ - Multiplex support
15
16
- Similar API to the Socket.IO JS client
16
17
17
18
## How to use
@@ -68,8 +69,8 @@ void OnMessage(sio::event &)
68
69
{
69
70
70
71
}
71
-
72
72
h.socket()->on("new message", &OnMessage);
73
+
73
74
/********************* bind with lambda ********************/
74
75
h.socket()->on("login", [&](sio::event& ev)
75
76
{
@@ -154,30 +155,29 @@ Bind the error handler for socket.io error messages.
154
155
Unbind the error handler.
155
156
156
157
```C++
157
-
158
- //event object:
159
- class event
160
- {
161
- public:
162
- const std::string& get_nsp() const;
163
-
164
- const std::string& get_name() const;
165
-
166
- const message::ptr& get_message() const;
167
-
168
- bool need_ack() const;
169
-
170
- void put_ack_message(message::ptr const& ack_message);
158
+ //event object:
159
+ class event
160
+ {
161
+ public:
162
+ const std::string& get_nsp() const;
163
+
164
+ const std::string& get_name() const;
165
+
166
+ const message::ptr& get_message() const;
167
+
168
+ bool need_ack() const;
169
+
170
+ void put_ack_message(message::ptr const& ack_message);
171
+
172
+ message::ptr const& get_ack_message() const;
173
+ ...
174
+ };
175
+ //event listener declare:
176
+ typedef std::function<void(const std::string& name,message::ptr const& message,bool need_ack, message::ptr& ack_message)> event_listener_aux;
171
177
172
- message::ptr const& get_ack_message() const;
173
- ...
174
- };
175
- //event listener declare:
176
- typedef std::function<void(const std::string& name,message::ptr const& message,bool need_ack, message::ptr& ack_message)> event_listener_aux;
177
-
178
- typedef std::function<void(event& event)> event_listener;
179
-
180
- typedef std::function<void(message::ptr const& message)> error_listener;
178
+ typedef std::function<void(event& event)> event_listener;
179
+
180
+ typedef std::function<void(message::ptr const& message)> error_listener;
181
181
182
182
```
183
183
0 commit comments