Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/reiiyuki/socketiomanager-unity
Event based Communnication Manger for SocketIO
https://github.com/reiiyuki/socketiomanager-unity
event-driven events socket-io socketio unity
Last synced: 7 days ago
JSON representation
Event based Communnication Manger for SocketIO
- Host: GitHub
- URL: https://github.com/reiiyuki/socketiomanager-unity
- Owner: ReiiYuki
- License: mit
- Created: 2018-03-03T15:23:47.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-04T08:18:51.000Z (almost 7 years ago)
- Last Synced: 2024-12-09T10:48:48.507Z (2 months ago)
- Topics: event-driven, events, socket-io, socketio, unity
- Language: C#
- Homepage:
- Size: 174 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# SocketIO Manager Unity
Event based Communnication Manger for SocketIO
## Usage
* Drag SocketIO Manager from `Assets\SocketIOManager\Prefabs\SocketIO Manager.prefab` to Unity Scene
* Write event handler script and register it to Socket Manager## Binding Event Example
```cs
using Facebook.Unity;
using System.Collections.Generic;
using UnityEngine;
using SocketIO;
using SocketIOManager;namespace ARTag
{
public class ExampleEventHandler : SocketManager
{SocketManager socket;
const string SAMPLE_EVENT = "sample";
// Use this for initialization
void Start()
{
socket = GameObject.FindObjectOfType();
socket.Register(gameObject);
socket.On(SAMPLE_EVENT, OnSampleEvent);
}void OnSampleEvent(SocketIOEvent e)
{
// Do something
socket.Emit(SAMPLE_EVENT, sampleData);
}void OnConnectionOpen(){
// Do something when connection is openned.
}
void OnConnectionClose(){
// Do something when connection is closed.
}
void OnConnectionError(){
// Do something when connection is error.
}
}}
```