Giter VIP home page Giter VIP logo

socket.io-unity's Introduction

socket.io-unity

unity-nodejs

Socket.IO Client Library for Unity (mono / .NET 2.0), which is ported from the JavaScript client version 1.1.0.

SocketIoClientDotNet by Quobject is a very good project, but it does not support Unity. So I spent a few overnights to port it to mono/.NET 2.0.

Now game developers can:

  • use node.js to develop game server, enjoy the powerful ecosystem of network and database, easily deploy to cloud;
  • use Unity to develop game client, enjoy the poweful game engine and IDE.
  • use websocket / socket.io to communicate between server/client.

Installation

Downlaod socket.io.unitypackage and then import into Unity.

Or, only download the following files in Lib and put to Unity project:

  • WebSocket4Net.dll
  • SocketIoClientDotNet.dll
  • Newtonsoft.Json.dll

It's available on Unity Asset Store for $10, but you can also download it for FREE here.

If you are interested to dig into the source code, welcome to fork the SocketIoClientDotNet for .NET 2.0.

Usage

socket.io client for Unity has a similar api to those of the JavaScript client.

using Quobject.SocketIoClientDotNet.Client;

var socket = IO.Socket("http://localhost:3000");
socket.On(Socket.EVENT_CONNECT, () =>
{
  socket.Emit("hi");
});
socket.On("hi", (data) =>
{
  Debug.Log(data);
  socket.Disconnect();
});

And, with Newtonsoft.Json.dll, we can easliy serialize / deserialize json object. Read more about Newtonsoft.Json.

Features

This library supports all of the features the JS client does, including events, options and upgrading transport.

Framework Versions

Mono, .NET 2.0

Demo

Comparison

Project Author Popularity Status
socket.io-unity floatinghotpot new ACTIVE, support .NET 2.0 and Unity
SocketIoClientDotNet Quobject 323 stars ACTIVE, support .NET 3.5 and higher, but not compatible with .NET 2.0 and Unity
UnitySocketIO NetEase 547 stars no longer maintained, not compatible with socket.io 1.x and later
unity-socket.io-DEPRECATED fpanettieri 189 stars no longer maintained
UnitySocketIO-WebSocketSharp kaistseo 108 stars no longer maintained

Credit

Thanks to the authors of following projects:

socket.io-unity's People

Contributors

floatinghotpot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.