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
// You can print the returned data first to decide what to do next.
34
+
// output: ["hi client"]
35
+
Console.WriteLine(response);
13
36
14
-
> While WebSocket is clearly the best way to establish a bidirectional communication, experience has shown that it is not always possible to establish a WebSocket connection, due to corporate proxies, personal firewall, antivirus software…
- SocketIOClient v3.x supports http polling, but if websocket is available, the library will choose to use websocket. If you want to use http polling and do not want the library to upgrade the transport, please set `Options.AutoUpgrade = false`.
19
-
- Socket.io server v2.x is no longer supported. If a large number of users use this version, please feedback.
43
+
client.On("test", response=>
44
+
{
45
+
// You can print the returned data first to decide what to do next.
|`Path`|`/socket.io`| name of the path that is captured on the server side |
88
+
|`Reconnection`|`true`| whether to reconnect automatically |
89
+
|`ReconnectionAttempts`|`int.MaxValue`| number of reconnection attempts before giving up |
90
+
|`ReconnectionDelay`|`1000`| how long to initially wait before attempting a new reconnection. Affected by +/- `RandomizationFactor`, for example the default initial delay will be between 500 to 1500ms. |
|`Query`|`IEnumerable<KeyValuePair<string, string>>`| additional query parameters that are sent when connecting a namespace (then found in `socket.handshake.query` object on the server-side) |
94
+
|`AutoUpgrade`|`true`| If websocket is available, it will be automatically upgrade to use websocket |
28
95
29
-
Use ClientWebSocketProvider instead of Socket object.
96
+
## Ack
30
97
31
-
#Breaking changes in 2.2.4
98
+
### The server executes the client's ack function
32
99
33
-
Before SocketIOClient v2.2.4, the default EIO is 3, which works with socket.io v2.x, in SocketIOClient v2.2.4, the default EIO is 4, which works with socket.io v3.x and v4.x
100
+
**Client**
101
+
102
+
```cs
103
+
awaitclient.EmitAsync("ack", response=>
104
+
{
105
+
// You can print the returned data first to decide what to do next.
SocketIOClient v2.2.0 makes `System.Text.Json` the default JSON serializer. If you'd like to continue to use `Newtonsoft.Json`, add the **SocketIOClient.Newtonsoft.Json** NuGet package and set your **JsonSerializer** to **NewtonsoftJsonSerializer** on your SocketIO instance. System.Text.Json is faster and uses less memory.
The library uses System.Net.WebSockets.ClientWebSocket by default. Unfortunately, it does not support Windows 7 or Windows Server 2008 R2. You will get a PlatformNotSupportedException. To solve this problem, you need to install the `SocketIOClient.Windows7` dependency and then change the implementation of ClientWebSocket.
Before development or testing, you need to install the nodejs.
265
+
## Breaking changes in 3.x
96
266
97
-
```bash
98
-
# start socket.io v2 server
99
-
cd src/socket.io-server-v2
100
-
npm i # If the dependencies are already installed, you can ignore this step.
101
-
npm start
267
+
> While WebSocket is clearly the best way to establish a bidirectional communication, experience has shown that it is not always possible to establish a WebSocket connection, due to corporate proxies, personal firewall, antivirus software…
102
268
103
-
# start socket.io v3 server
104
-
cd src/socket.io-server-v3
105
-
npm i # If the dependencies are already installed, you can ignore this step.
- SocketIOClient v3.x supports http polling, but if websocket is available, the library will choose to use websocket. If you want to use http polling and do not want the library to upgrade the transport, please set `Options.AutoUpgrade = false`.
272
+
- Socket.io server v2.x is no longer supported. If a large number of users use this version, please feedback.
273
+
274
+
### Specific break changes
275
+
276
+
#### 1. EIO option removed
277
+
278
+
Since socket.io server v2 is not supported, the EIO option is not required.
279
+
280
+
#### 2. Removed the 'Socket' object
281
+
282
+
Use ClientWebSocketProvider instead of Socket object.
283
+
284
+
## Breaking changes in 2.2.4
285
+
286
+
Before SocketIOClient v2.2.4, the default EIO is 3, which works with socket.io v2.x, in SocketIOClient v2.2.4, the default EIO is 4, which works with socket.io v3.x and v4.x
287
+
288
+
## Breaking changes in 2.2.0
289
+
290
+
SocketIOClient v2.2.0 makes `System.Text.Json` the default JSON serializer. If you'd like to continue to use `Newtonsoft.Json`, add the **SocketIOClient.Newtonsoft.Json** NuGet package and set your **JsonSerializer** to **NewtonsoftJsonSerializer** on your SocketIO instance. System.Text.Json is faster and uses less memory.
0 commit comments