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: README.md
+29-3Lines changed: 29 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,11 +6,37 @@ For Unity developers looking to use Web Sockets in their Unity game / app.
6
6
7
7
**First download the required dependencies and extract the contents into your Unity project "Assets" folder.**
8
8
9
-
*[WebSocket-Sharp (fork with Custom Headers support)](https://github.com/deadlyfingers/websocket-sharp)
9
+
*[WebSocket-Sharp* forked for supporting custom headers](https://github.com/deadlyfingers/websocket-sharp)
10
10
11
-
## Developer notes
11
+
## Features
12
12
13
-
When using Unity 2017.2.1p2 and the .NET 4.6 API (Experimental) player settings I tried the system [ClientWebSocket](https://msdn.microsoft.com/en-us/library/system.net.websockets.clientwebsocket%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396). While this initially had some success the problem was that after 3 mins or so the following error would occur on the async/await connect function:
13
+
-**IWebSocket** interface for targeting the various platforms Unity supports.
14
+
-**WebSocketMono** utilizes [WebSocket-Sharp*](https://github.com/deadlyfingers/websocket-sharp) and should work on all mono platforms including the Unity Editor on Mac and PC.
15
+
-**WebSocketUWP** utilizes [MessageWebSocket](https://docs.microsoft.com/en-us/uwp/api/windows.networking.sockets.messagewebsocket) for Windows 10 (UWP) apps.
16
+
17
+
## Interface methods
18
+
API | Description
19
+
--- | -----------
20
+
ConfigureWebSocket(url) | Configures web socket with url and optional headers
21
+
ConnectAsync() | Connect to web socket
22
+
CloseAsync() | Close web socket connection
23
+
SendAsync(data) | Send binary `byte[]` or UTF-8 text `string` with optional callback
24
+
IsOpen() | Check if web socket status is open
25
+
Url() | Return the URL being used by the web socket
[UnityWebSocketDemo project repo](https://github.com/Unity3dAzure/UnityWebSocketDemo) contains sample scenes showing how to hook all this up in the Unity Editor.
36
+
37
+
## Other developer notes
38
+
39
+
When using Unity 2017.2.1p2 and the .NET 4.6 API (Experimental) player settings I tried the system [ClientWebSocket](https://msdn.microsoft.com/en-us/library/system.net.websockets.clientwebsocket%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396). While this initially had some success the problem was that after 3 mins or so the following error would occur on the async/await connect function in the Unity Editor:
14
40
15
41
```
16
42
ObjectDisposedException: Cannot access a disposed object.
0 commit comments