public UnityTransportGeneric(string endpoint, IJsonMarshaller marshaller, int timeout = 60) { Endpoint = endpoint; Marshaller = marshaller; Timeout = timeout; ActiveRequests = 0; }
private int _timeout; // In Seconds public AsyncHttpTransportGeneric(string endpoint, IJsonMarshaller marshaller, int timeout = 60) { Endpoint = endpoint; _marshaller = marshaller; _timeout = timeout; ActiveRequests = 0; }
private int _timeout; // In Seconds public WebSocketTransportGeneric(string endpoint, IJsonMarshaller marshaller, ILogger logger, int timeout = 60) { Endpoint = endpoint; _logger = logger; _marshaller = marshaller; _timeout = timeout; _ws = new WebSocket(endpoint); _ws.OnMessage += (sender, e) => { if (e.IsPing) { logger.Logf(LogLevel.Trace, "WebSocketTransport: Ping received."); return; } OnMessage(e); }; _ws.OnOpen += (sender, e) => { OnOpen(); }; _ws.OnError += (sender, e) => { OnError(e); }; _ws.OnClose += (sender, e) => { OnClose(e); }; _ws.Compression = CompressionMethod.Deflate; _ws.EmitOnPing = true; _state = WebSocketTransportState.Stopped; _headersUpdated = true; _requests = new Dictionary <string, WSRequest>(); _dispatcher = new Dispatcher <C, string>(); }
public WebSocketServerHandler(Dispatcher <ConnectionContext <CH>, string> dispatcher, IJsonMarshaller marshaller, ILogger logger, IWebSocketServerHandlers <CH> handlers = null) { _handlers = handlers; _dispatcher = dispatcher; _logger = logger; _marshaller = marshaller; }
public UnityTransportGeneric(string endpoint, IJsonMarshaller marshaller, Action <IEnumerator> coroutineProcessor, int timeout = 60) { Endpoint = endpoint; Marshaller = marshaller; Timeout = timeout; CoroutineProcessor = coroutineProcessor; ActiveRequests = 0; }
public SimpleHttpServer(string prefix) { if (!HttpListener.IsSupported) { throw new NotSupportedException("Needs Windows XP SP2, Server 2003 or later."); } if (prefix == null) { throw new ArgumentException("prefix"); } this.prefix = prefix; listener = new HttpListener(); listener.Prefixes.Add(prefix.EndsWith("/") ? prefix : prefix + "/"); marshaller = new JsonNetMarshaller(); dispatcher = new Dispatcher <SimpleHttpServerContext, string>(); }
public WebSocketServerGeneric(string endpoint, IJsonMarshaller marshaller, ILogger logger, IWebSocketServerHandlers <C> handlers = null) { this._endpoint = endpoint; bool secured; if (endpoint.StartsWith("ws://")) { secured = false; } else if (endpoint.StartsWith("wss://")) { secured = true; } else { throw new Exception("Endpoint for a websocket server must start with ws:// or ws://"); } var pathStart = endpoint.IndexOf('/', secured ? 6 : 5); _endpoint = endpoint.Substring(0, pathStart); _path = endpoint.Substring(pathStart); if (string.IsNullOrEmpty(_path)) { _path = "/"; } logger.Logf(LogLevel.Trace, "WebSocketServer: Endpoint " + _endpoint); logger.Logf(LogLevel.Trace, "WebSocketServer: Path " + _path); _marshaller = marshaller; _logger = logger; _started = false; _dispatcher = new Dispatcher <ConnectionContext <C>, string>(); _wss = new WebSocketSharp.Server.WebSocketServer(_endpoint); // wss.Log.Level = WebSocketSharp.LogLevel.Debug; _wss.AddWebSocketService <WebSocketServerHandler <C> >(_path, () => new WebSocketServerHandler <C>(_dispatcher, marshaller, logger, handlers)); }
public SyncHttpTransport(string endpoint, IJsonMarshaller marshaller, int timeout = 60) : base(endpoint, marshaller, timeout) { }
public UnityTransport(string endpoint, IJsonMarshaller marshaller, Action <IEnumerator> coroutineProcessor, int timeout = 60) : base(endpoint, marshaller, coroutineProcessor, timeout) { }
public SyncHttpTransportGeneric(string endpoint, IJsonMarshaller marshaller, int timeout = 60) { _endpoint = endpoint; _marshaller = marshaller; _timeout = timeout; }
public WebSocketServer(string endpoint, IJsonMarshaller marshaller, ILogger logger, IWebSocketServerHandlers <object> handlers = null) : base(endpoint, marshaller, logger, handlers) { }
public WebSocketTransport(string endpoint, IJsonMarshaller marshaller, ILogger logger, int timeout = 60) : base(endpoint, marshaller, logger, timeout) { }