public void Send(string message) { if (IsOpen) { webSocket.Send(message); } }
/// <summary> /// It will send the given message to the server in one frame. /// </summary> public void Send(string message) { if (!IsOpen) { return; } #if (!UNITY_WEBGL || UNITY_EDITOR) webSocket.Send(message); #else WS_Send_String(this.ImplementationId, message); #endif }
/// <summary> /// 它将在一个帧中将给定的消息发送到服务器 /// </summary> public void Send(string message) { Debug.LogError("----------------------------------------1111---message!-----------------------------------:" + message); if (!IsOpen) { //Facade.Instance.SendNotification(ProConst.Msg_ShowHintInfo, new MsgModel("与服务器的websocket没有建立连接,无法发送消息..", Color.red)); // GameStart.OpenCommonConfirm("连接失败", "与服务器的websocket连接异常,即将退出", () => { Application.Quit(); }); Debug.LogError("与服务器的websocket没有建立连接,无法发送消息.."); return; } #if (!UNITY_WEBGL || UNITY_EDITOR) webSocket.Send(message); #else WS_Send_String(this.ImplementationId, message); #endif }
static int Send(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 2 && TypeChecker.CheckTypes <string>(L, 2)) { BestHTTP.WebSocket.WebSocketResponse obj = (BestHTTP.WebSocket.WebSocketResponse)ToLua.CheckObject(L, 1, typeof(BestHTTP.WebSocket.WebSocketResponse)); string arg0 = ToLua.ToString(L, 2); obj.Send(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes <byte[]>(L, 2)) { BestHTTP.WebSocket.WebSocketResponse obj = (BestHTTP.WebSocket.WebSocketResponse)ToLua.CheckObject(L, 1, typeof(BestHTTP.WebSocket.WebSocketResponse)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); obj.Send(arg0); return(0); } else if (count == 2 && TypeChecker.CheckTypes <BestHTTP.WebSocket.Frames.WebSocketFrame>(L, 2)) { BestHTTP.WebSocket.WebSocketResponse obj = (BestHTTP.WebSocket.WebSocketResponse)ToLua.CheckObject(L, 1, typeof(BestHTTP.WebSocket.WebSocketResponse)); BestHTTP.WebSocket.Frames.WebSocketFrame arg0 = (BestHTTP.WebSocket.Frames.WebSocketFrame)ToLua.ToObject(L, 2); obj.Send(arg0); return(0); } else if (count == 4) { BestHTTP.WebSocket.WebSocketResponse obj = (BestHTTP.WebSocket.WebSocketResponse)ToLua.CheckObject(L, 1, typeof(BestHTTP.WebSocket.WebSocketResponse)); byte[] arg0 = ToLua.CheckByteBuffer(L, 2); ulong arg1 = LuaDLL.tolua_checkuint64(L, 3); ulong arg2 = LuaDLL.tolua_checkuint64(L, 4); obj.Send(arg0, arg1, arg2); return(0); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: BestHTTP.WebSocket.WebSocketResponse.Send")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public override void Send(string message) { webSocket.Send(message); }