Skip to content

websocket client implementation for Unity.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

ToshikiImagawa/WebuSocket

 
 

Repository files navigation

WebuSocket

WebSocket Client implementation for C#.
ver 0.7.6

motivation

  • async default.
  • lightweight.
  • thread free.
  • task free.
  • runnable on C# 3.5 or later(includes Unity).

usage

var webuSocket = new WebuSocket(
	"ws://somewhere:someport",
	1024 * 100,// default buffer size.
	() => {
		// connected.
	}, 
	(Queue<ArraySegment<byte>> datas) => {
		// data received.
		
		while (0 < datas.Count) {
			var data = datas.Dequeue();
			var bytes = new byte[data.Count];
			Buffer.BlockCopy(data.Array, data.Offset, bytes, 0, data.Count);
			
			// use "bytes".
		}
	}, 
	() => {
		// pinged.
	}, 
	closeReason => {
		// closed.
	}, 
	(errorReason, e) => {
		// error happedned.
	}, 
	customHeaderKeyValues // Dictionary<string, string> which can send with connecting signal.
);

sample unity project is here
SampleProject

implemented

  • basic WebSocket API
  • connect by ipv4 & 6
  • connect by domain
  • tls
  • reconnection
  • disconnect detection by ping-pong timeout
  • basic auth

not yet implemented

  • http redirection(necessary?)
  • tls 1.3
  • else...

contribution welcome!

license

see below.
LICENSE

About

websocket client implementation for Unity.

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 100.0%