2020-07-08

This commit is contained in:
2020-07-08 08:01:34 +08:00
parent e344c54d82
commit 650da9efae
97 changed files with 1469 additions and 475 deletions

View File

@@ -104,11 +104,11 @@ namespace Dist.SpringWebsocket
{
if (result.MessageType == WebSocketMessageType.Text)
{
//string msg = Encoding.UTF8.GetString(array, 0, result.Count);
//if (isDebug)
//{
// Debug.Log("receive:" + result.Count + "==\n" + msg);
//}
if (isDebug)
{
string msg = Encoding.UTF8.GetString(array, 0, result.Count);
Debug.Log("receive:" + result.Count + "==\n" + msg);
}
socket_MessageReceived(client, array, result.Count);
}
else if (result.MessageType == WebSocketMessageType.Close)
@@ -276,14 +276,14 @@ namespace Dist.SpringWebsocket
}
public void DisConnect()
{
ArrayList list = new ArrayList();
list.AddRange(subscribes.Keys);
foreach (var key in list)
{
UnSubscribe(key.ToString());
}
this.callbacks.Clear();
this.subscribes.Clear();
//ArrayList list = new ArrayList();
//list.AddRange(subscribes.Keys);
//foreach (var key in list)
//{
// UnSubscribe(key.ToString());
//}
//this.callbacks.Clear();
//this.subscribes.Clear();
_send(StompCommandEnum.DISCONNECT.ToString() + LF + LF + NULL);
this.connected = false;
isSending = false;
@@ -406,6 +406,12 @@ namespace Dist.SpringWebsocket
frame.callback = callback;
queueCallback.Enqueue(frame);
break;
case StatusCodeEnum.ERROR:
socket.Abort();
socket.Dispose();
socket = null;
Debug.LogWarning(frame.Code);
break;
default:
Debug.LogError(frame.Code);
break;