diff --git a/src/http/interfaces/IHTTP.ServerTo.cs b/src/http/interfaces/IHTTP.ServerTo.cs index 24c66315..b2e693f2 100644 --- a/src/http/interfaces/IHTTP.ServerTo.cs +++ b/src/http/interfaces/IHTTP.ServerTo.cs @@ -27,9 +27,9 @@ public interface ServerTo void WebsocketDataBroadcast(string data, HTTP.MessageType messageType); void WebsocketDataBroadcast(string data, HTTP.MessageType messageType, Encoding encoding); - void WebsocketEventBroadcast(string name, byte[] data); - void WebsocketEventBroadcast(string name, string data); - void WebsocketEventBroadcast(string name, string data, Encoding encoding); + void WebsocketEventBroadcast(string name, byte[] data, HTTP.MessageType messageType); + void WebsocketEventBroadcast(string name, string data, HTTP.MessageType messageType); + void WebsocketEventBroadcast(string name, string data, HTTP.MessageType messageType, Encoding encoding); } } } \ No newline at end of file diff --git a/src/http/interfaces/IHTTP.WebSocketOn.cs b/src/http/interfaces/IHTTP.WebSocketOn.cs index 54a9cde2..8cf8ade5 100644 --- a/src/http/interfaces/IHTTP.WebSocketOn.cs +++ b/src/http/interfaces/IHTTP.WebSocketOn.cs @@ -17,7 +17,7 @@ public interface WebSocketOn : IOn /// Handle (netly event) received /// /// Callback - void Event(Action callback); + void Event(Action callback); /// /// Handle connection closed diff --git a/src/http/interfaces/IHTTP.WebSocketTo.cs b/src/http/interfaces/IHTTP.WebSocketTo.cs index bd16a556..535a718d 100644 --- a/src/http/interfaces/IHTTP.WebSocketTo.cs +++ b/src/http/interfaces/IHTTP.WebSocketTo.cs @@ -53,14 +53,14 @@ public interface WebSocketTo /// /// Event name /// Event buffer - void Event(string name, byte[] buffer); + void Event(string name, byte[] buffer, HTTP.MessageType messageType); /// /// Send Netly event for server (string) /// /// Event name /// Event buffer - void Event(string name, string buffer); + void Event(string name, string buffer, HTTP.MessageType messageType); /// /// Send Netly event for server (string) @@ -68,7 +68,7 @@ public interface WebSocketTo /// Event name /// Event buffer /// String encoding - void Event(string name, string buffer, Encoding encoding); + void Event(string name, string buffer, HTTP.MessageType messageType, Encoding encoding); } } } \ No newline at end of file diff --git a/src/http/partials/Server/HTTP.ServerTo.cs b/src/http/partials/Server/HTTP.ServerTo.cs index 8e176928..8e6e50ea 100644 --- a/src/http/partials/Server/HTTP.ServerTo.cs +++ b/src/http/partials/Server/HTTP.ServerTo.cs @@ -123,27 +123,27 @@ public void WebsocketDataBroadcast(string data, HTTP.MessageType messageType, En } } - public void WebsocketEventBroadcast(string name, byte[] data) + public void WebsocketEventBroadcast(string name, byte[] data, HTTP.MessageType messageType) { lock (_websocketListLock) { - foreach (var ws in _websocketList) ws.To.Event(name, data); + foreach (var ws in _websocketList) ws.To.Event(name, data, messageType); } } - public void WebsocketEventBroadcast(string name, string data) + public void WebsocketEventBroadcast(string name, string data, HTTP.MessageType messageType) { lock (_websocketListLock) { - foreach (var ws in _websocketList) ws.To.Event(name, data); + foreach (var ws in _websocketList) ws.To.Event(name, data, messageType); } } - public void WebsocketEventBroadcast(string name, string data, Encoding encoding) + public void WebsocketEventBroadcast(string name, string data, MessageType messageType, Encoding encoding) { lock (_websocketListLock) { - foreach (var ws in _websocketList) ws.To.Event(name, data, encoding); + foreach (var ws in _websocketList) ws.To.Event(name, data, messageType, encoding); } } diff --git a/src/http/partials/Websocket/HTTP.WebSocketTo.cs b/src/http/partials/Websocket/HTTP.WebSocketTo.cs index 5da50473..4aa9162c 100644 --- a/src/http/partials/Websocket/HTTP.WebSocketTo.cs +++ b/src/http/partials/Websocket/HTTP.WebSocketTo.cs @@ -178,19 +178,19 @@ public void Data(string buffer, HTTP.MessageType messageType, Encoding encoding) Send(buffer.GetBytes(encoding), messageType); } - public void Event(string name, byte[] buffer) + public void Event(string name, byte[] buffer, HTTP.MessageType messageType) { - Send(NetlyEnvironment.EventManager.Create(name, buffer), MessageType.Binary); + Send(NetlyEnvironment.EventManager.Create(name, buffer), messageType); } - public void Event(string name, string buffer) + public void Event(string name, string buffer, HTTP.MessageType messageType) { - Send(NetlyEnvironment.EventManager.Create(name, buffer.GetBytes()), MessageType.Binary); + Send(NetlyEnvironment.EventManager.Create(name, buffer.GetBytes()), messageType); } - public void Event(string name, string buffer, Encoding encoding) + public void Event(string name, string buffer, HTTP.MessageType messageType, Encoding encoding) { - Send(NetlyEnvironment.EventManager.Create(name, buffer.GetBytes(encoding)), MessageType.Binary); + Send(NetlyEnvironment.EventManager.Create(name, buffer.GetBytes(encoding)), messageType); } private void Send(byte[] buffer, HTTP.MessageType type) @@ -264,7 +264,7 @@ private async void ReceiveJob(object _) if (eventData.data != null && eventData.name != null) // Is Netly Event - _socket._on.OnEvent?.Invoke(null, (eventData.name, eventData.data)); + _socket._on.OnEvent?.Invoke(null, (eventData.name, eventData.data, messageType)); else // Is Default buffer _socket._on.OnData?.Invoke(null, (data, messageType));