Unity and WebSocket

Akshay Kale
2 min readSep 4, 2018

--

Communicate with the websocket in unity-3d.

Use WebSocket-Sharp library to implement websockets in Unity.

OPTION 1 : Generate the .dll file

> Clone the repo from github: https://github.com/sta/websocket-sharp

git clone https://github.com/sta/websocket-sharp.git
cd websocket-sharp

> Open it with MonoDevelop (double click on websocket-sharp.sln file)

> Remove the Folders “Example, Example1, Example2, Example3” from the visual studio. Select these folders -> right click ->remove.

> In Visual Studio, change the build method to “Release”

> Build the project. Once build is successful the “websocket-sharp.dll” should be generated in the /bin/Release/websocket-sharp.dll .

> Copy this .dll file in your Assets/Plugins folder in Unity.

Option 2: Install using Package manager

> Unity has a open source package manager called NuGet.

> Head to asset store (https://assetstore.unity.com/packages/tools/utilities/nuget-for-unity-104640) . Download and import this asset.

> Then search for WebsocketSharp and hit install button. (In my case it is already installed. You should see the install button.)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response