Skip to content

GameFrameX/com.gameframex.unity.psygames.unitywebsocket

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

212 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game Frame X Logo

Game Frame X UnityWebSocket

License Version Documentation

All-in-One Solution for Indie Game Development · Empowering Indie Developers' Dreams

Documentation · Quick Start · QQ Group · Language


Language

English | 简体中文 | 繁體中文 | 日本語 | 한국어


Project Overview

WebSocket library for Unity. This library primarily serves as a sub-library for https://github.com/AlianBlank/GameFrameX.

Quick Start

Installation (three methods)

  1. Add the following content directly to manifest.json:

    {"com.gameframex.unity.psygames.unitywebsocket": "https://github.com/AlianBlank/com.gameframex.unity.psygames.unitywebsocket.git"}
  2. Add via Unity's Package Manager using Git URL: https://github.com/AlianBlank/com.gameframex.unity.psygames.unitywebsocket.git

  3. Download the repository directly and place it in the Unity project's Packages directory. It will be auto-loaded.

Modifications

  1. Added IsConnected property.

Usage Examples

Online Demo

Basic Usage

// the namespace
using UnityWebSocket;

// create instance
string address = "ws://echo.websocket.org";
WebSocket socket = new WebSocket(address);

// register callback
socket.OnOpen += OnOpen;
socket.OnClose += OnClose;
socket.OnMessage += OnMessage;
socket.OnError += OnError;

// connect
socket.ConnectAsync();

// send string data
socket.SendAsync(str);
// or send byte[] data (suggested)
socket.SendAsync(bytes);

// close connection
socket.CloseAsync();

Unity Define Symbols (Optional)

  • UNITY_WEB_SOCKET_LOG Open internal log info.
  • UNITY_WEB_SOCKET_ENABLE_ASYNC Use network thread handle message (not WebGL platform).

Changelog

See CHANGELOG.md for details.

License

See the LICENSE file for details.

About

UnityWebSocket - Lightweight WebSocket client library for Unity with cross-platform support and easy-to-use API

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • C# 84.5%
  • JavaScript 15.5%