Giter Club home page Giter Club logo

unitywebsocket's People

Contributors

psygames avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unitywebsocket's Issues

Reconnect

Hi! How can I implement reconnection?
I will notice that there is a timeout in the WebSocketManager
"bool clearCheck = Time.realtimeSinceStartup - clearCheckTimeStamp> = 60;"
which deletes the socket
And after 1 minute offline I don't get OnClose message

在Unity2019.3.0f6上测试失败

错误日志如下:

failed to asynchronously prepare wasm: LinkError: WebAssembly.instantiate(): memory import 0 is smaller than initial 512, got 256
printErr @ UnityLoader.js:4
UnityLoader.js:4 LinkError: WebAssembly.instantiate(): memory import 0 is smaller than initial 512, got 256
UnityLoader.js:4 LinkError: WebAssembly.instantiate(): memory import 0 is smaller than initial 512, got 256
printErr @ UnityLoader.js:4
(index):1 Uncaught (in promise) abort({}) at Error
    at jsStackTrace (blob:http://localhost:54116/7b9ed2df-807b-49e4-a462-2f99819e16e2:8:22313)
    at Object.stackTrace (blob:http://localhost:54116/7b9ed2df-807b-49e4-a462-2f99819e16e2:8:22484)
    at Object.onAbort (http://localhost:54116/Build/UnityLoader.js:4:11118)
    at abort (blob:http://localhost:54116/7b9ed2df-807b-49e4-a462-2f99819e16e2:8:512213)
    at blob:http://localhost:54116/7b9ed2df-807b-49e4-a462-2f99819e16e2:8:31378

另外 Unity2019没有Publishing Settings -> Linker Target

如何設定SSL連結wss

使用2.4.5的版本,可以連上ws但是要用wss時會無法連上
請問要如何設定SslConfiguration讓其連上wss呢?
謝謝

使用新的2.5.0版本在IL2CPP打包报错,仍然要修改为.NET 4.x。

使用的Unity版本:2020.3.10f1c1。

打包平台:iOS 和 Android 使用 IL2CPP 都报错

详细报错信息:
Exception: IL2CPP error (no further information about what managed code was being converted is available)
Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'

解决办法:Api Level 默认为:.Net Standard 2.0。修改为.NET 4.x可以打包成功。

消息可能无法正常发送的Bug

image

在SendBufferAsync的163行sendQueue.Enqueue(buffer); 把消息压进队列的时候 下面的SendTask()线程可能已经退出了 导致消息需要到下次发送其他消息的时候 才会一起发送

SendMessage: object WebSocket not found!

hello,
when i running webgl on the node server. he can connect the server, but when i prepare to send or receive messages, the webgl console always show the info: "SendMessage: object WebSocket not found!"
I don't known why and I have bloc here for a long time. thank you for response.

Can't connect to wss again!

I'm using version 2.6.4 connect to my wss server it's said "Unable to connect to the remote server" and then when I switch my server to ws it work normally.

future request: Allow to set headers like Authentication

Hi,

It'll be helpful if this project can support setting custom headers. I'm using JWT authentication, and need to set header:

Authorization: Bearer <myToken>

for websocket-sharp, it supports HTTP Authentication (Basic/Digest) by using ws.SetCredentials ("nobita", "password", preAuth);, which will add header:

Authorization: Basic <realmToken>

Cloud you please add a function to set headers like:

ws= new WebSocket(address);
ws.SetHeader("Authorization", "Bearer " + myToken);

Thanks!

求指教: 打开或关闭socket, 都会报一个错误,经常出现这个问题

打开报错如下:

Socket onError: An error has occurred during the OnOpen event.
UnityWebSocket.WebSocket:<WebSocket>m__2(Object, ErrorEventArgs) (at UnityWebSocket/WebSocket.cs:112)
WebSocketSharp.Ext:Emit(EventHandler`1, Object, ErrorEventArgs) (at UnityWebSocket/websocket-sharp/Ext.cs:1254)
WebSocketSharp.WebSocket:error(String, Exception) (at UnityWebSocket/websocket-sharp/WebSocket.cs:1421)
WebSocketSharp.WebSocket:open() (at UnityWebSocket/websocket-sharp/WebSocket.cs:1537)
WebSocketSharp.WebSocket:Connect() (at UnityWebSocket/websocket-sharp/WebSocket.cs:3241)
UnityWebSocket.WebSocket:Connect() (at UnityWebSocket/WebSocket.cs:123)

关闭报错如下:

Socket onError: An error has occurred during the OnClose event.
UnityWebSocket.WebSocket:<WebSocket>m__2(Object, ErrorEventArgs) (at UnityWebSocket/WebSocket.cs:112)
WebSocketSharp.Ext:Emit(EventHandler`1, Object, ErrorEventArgs) (at UnityWebSocket/websocket-sharp/Ext.cs:1254)
WebSocketSharp.WebSocket:error(String, Exception) (at UnityWebSocket/websocket-sharp/WebSocket.cs:1421)
WebSocketSharp.WebSocket:close(PayloadData, Boolean, Boolean, Boolean) (at UnityWebSocket/websocket-sharp/WebSocket.cs:1140)
WebSocketSharp.WebSocket:close(UInt16, String) (at UnityWebSocket/websocket-sharp/WebSocket.cs:1094)
WebSocketSharp.WebSocket:Close() (at UnityWebSocket/websocket-sharp/WebSocket.cs:2566)
UnityWebSocket.WebSocket:Close() (at UnityWebSocket/WebSocket.cs:143)

虽然第一次打开连接会报错,不过最后OnOpen走了两次,第二次能连接成功

 private void OnOpen(object sender, EventArgs e)
        {
            Debug.Log("Socket Connected");
        }

请教:如果后台都是以string的格式给client发送json数据,用这个组件该怎么接收呢?

大致看了下代码,WebSocket.cs中定义的只接受byte[]格式

public Action<byte[]> onReceive { get; set; }

调用的是MessageEventArgs.cs文件中的代码

public byte[] RawData { get { setData (); return _rawData; } }

如果服务器给client都以string的形式发送json数据,请教该怎么接收数据呢?(同理: client也会直接发送string给服务器端)

谢谢大神们!

这个库通过Unity打包到IOS平台直接报错啊,.Net是4.0版本

错误提示如下:

Undefined symbols for architecture armv7: "_SendStrJS", referenced from: _WebSocket_SendStrJS_m828571625 in Bulk_Assembly-CSharp_2.o (maybe you meant: _WebSocket_SendStrJS_m828571625) "_SendJS", referenced from: _WebSocket_SendJS_m2279827315 in Bulk_Assembly-CSharp_2.o (maybe you meant: _WebSocket_SendJS_m2279827315) "_ConnectJS", referenced from: _WebSocket_ConnectJS_m1770216249 in Bulk_Assembly-CSharp_2.o (maybe you meant: _WebSocket_ConnectJS_m1770216249) "_GetReadyStateJS", referenced from: _WebSocket_GetReadyStateJS_m3781595125 in Bulk_Assembly-CSharp_2.o (maybe you meant: _WebSocket_GetReadyStateJS_m3781595125) "_CloseJS", referenced from: _WebSocket_CloseJS_m3737965298 in Bulk_Assembly-CSharp_2.o (maybe you meant: _WebSocket_CloseJS_m3737965298) "__copyTextToClipboard", referenced from: _InviteCodeManager__copyTextToClipboard_m3335060872 in Bulk_Assembly-CSharp_1.o (maybe you meant: _InviteCodeManager__copyTextToClipboard_m3335060872) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

我们只需要Android, IOS 如果不需要打包WebGL平台,websocket-jslib目录下的两个文件可以删除吗? 貌似是这里的错误

baidushurufa_2018-11-6_14-16-51

谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.