Giter VIP home page Giter VIP logo

socket.io-client-unity3d's Introduction

Socket.IO-Client-Unity3D

Download license

Features

Socket.IO-Client for Unity3D, which is compatible with Socket.IO v1.0 and later. (Socket.IO V2 is not supported currently) Socket.io is Opensource Realtime application framework. Socket.io group page : https://github.com/socketio

Versioning

  • The version of Socket.IO-Client-Unity3D follows Semantic Versioning 2.0.

  • Given a version number MAJOR.MINOR.PATCH, increment the

    1. MAJOR version when you make incompatible API changes,
    2. MINOR version when you add functionality in a backwards-compatible manner, and
    3. PATCH version when you make backwards-compatible bug fixes.
  • Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

Documentation

Reference to the Wiki section of GitHub.

Roadmap

  • At NHN Entertainment, we service Real-Time Communication System (a.k.a. RTCS) developed by NHN Entertainment.
  • So, We will try to improve performance and convenience according to this roadmap.

Milestones

Milestone Release Date
1.0.0 April 2017
1.0.1 May 2017
1.1.1 July 2017
2.0.0 2017

2.0.0 features planed

Improve performance and convenience, and documentation. Consider the performance test. Support Socket.IO v2.

Contributing

Bug Reporting

If you find a bug, it is very important to report it. We would like to help you and smash the bug away. If you can fix a bug, you can send pull request (Should register a issue before sending PR)

Before Reporting

Look into our issue tracker to see if the bug was already reported and you can add more information of the bug.

Creating new issue

A bug report should contain the following

  • An useful description of the bug

  • The steps to reproduce the bug

  • Details of system environments (OS)

  • What actually happened?

  • Which branch have you used?

Thank you for reporting a bug!

Mailing list

[email protected]

Contributor

  • Junhwan, Oh
  • Doyoung, An
  • Chanyoung, Park

License

Socket.IO-Client-Unity3D is licensed under the MIT license, see LICENSE for details.

The MIT License (MIT)

Copyright (c) 2017 NHN Entertainment Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

socket.io-client-unity3d's People

Contributors

cybaek avatar hectorpulido avatar ppz0th avatar smallmiro 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

socket.io-client-unity3d's Issues

No ability to pass EmitEvent, ListenEvent etc. as templates to Server.of(...) method

You can do assign types to .emit(..) and .event(..) by template constructor like this:
const socketServer = new Server<ServerToClientEvents, ClientToServerEvents, InterServerEvents, SocketData>("chat");
but it's missing ability to do like this:
socketServer.of<ServerToClientEvents, ClientToServerEvents, InterServerEvents, SocketData>("/myNamespace")

unity webSocketInstances is not defined,ReferenceError: webSocketInstances is not defined

exception thrown: ReferenceError: webSocketInstances is not defined,ReferenceError: webSocketInstances is not defined
at SocketCreate (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:66:17)
at _SocketCreate (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :2834:40)
at Array._SocketCreate__wrapper (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4574286:10)
at Object.ftCall_ii [as dynCall_ii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6706:46)
at invoke_ii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6693:31)
at _WebSocketWrapper_SocketCreate_m903007767 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :3435391:8)
at Array.asm._WebSocketWrapper_SocketCreate_m903007767 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4249361:57)
at Object.ftCall_iiii [as dynCall_iiii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6910:48)
at invoke_iiii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6897:33)
at _WebSocketWrapper_ConnectInternal_m3637984849 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :3829692:7)
at Array.asm._WebSocketWrapper_ConnectInternal_m3637984849 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4522643:61)
at Object.ftCall_viii [as dynCall_viii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6502:48)
at invoke_viii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6489:26)
at _WebSocketWrapper_Connect_m829512760 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :3299268:5)
at Array.asm._WebSocketWrapper_Connect_m829512760 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4440089:52)
at Object.ftCall_vii [as dynCall_vii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :5958:47)
at invoke_vii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :5945:25)
at Array._U3CInitCoreU3Ec__Iterator0_MoveNext_m2591192826 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :259158:18)
at mftCall_iii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4191259:100)
at __ZN21InterfaceFuncInvoker0IbE6InvokeEjP11Il2CppClassP12Il2CppObject (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :3293660:9)
at Array.asm.__ZN21InterfaceFuncInvoker0IbE6InvokeEjP11Il2CppClassP12Il2CppObject (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4253837:84)
at Object.ftCall_iiii [as dynCall_iiii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6910:48)
at invoke_iiii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6897:33)
at Array._SetupCoroutine_InvokeMoveNext_m2975616245 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :2668840:10)
at mftCall_viiii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4165159:39)
at _Z53RuntimeInvoker_Void_t1841601450_Il2CppObject_IntPtr_tPK10MethodInfoPvPS2 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4125827:2)
at Array.asm._Z53RuntimeInvoker_Void_t1841601450_Il2CppObject_IntPtr_tPK10MethodInfoPvPS2 (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4523999:94)
at Object.ftCall_iiii [as dynCall_iiii] (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6910:48)
at invoke_iiii (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :6897:33)
at __ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :3939572:8)
at _il2cpp_runtime_invoke (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4161323:9)
at asm._il2cpp_runtime_invoke (eval at loadDynamicLibrary (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:781:19), :4341179:38)
at _il2cpp_runtime_invoke (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:11640:42)
at __Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2517991:8)
at __ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:1790861:7)
at __ZN9Coroutine14InvokeMoveNextEP21ScriptingExceptionPtr (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2039567:2)
at __ZN9Coroutine3RunEPb (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2235390:7)
at __ZN9Coroutine17ContinueCoroutineEP6ObjectPv (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2611278:8)
at mftCall_iii (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2662614:98)
at __ZN18DelayedCallManager6UpdateEi (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:1040236:33)
at mftCall_vii (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2664628:37)
at __ZZ23InitPlayerLoopCallbacksvEN44UpdateScriptRunDelayedDynamicFrameRatestruct7ForwardEv (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2665861:2)
at mftCall_v (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:2699014:35)
at __Z10PlayerLoopv (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:771322:14)
at __ZL8MainLoopv (blob:http://localhost/2faeed81-e8d1-4561-88a1-e55ddd8cf2c1:1992203:3)
at Array.UnityLoader.873d35c852dfa40f9f7c2e481511bec7.asm.__ZL8MainLoopv (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:197895:29)
at Object.ftCall_v [as dynCall_v] (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:29779:28)
at browserIterationFunc (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:3089:23)
at Object.runIter (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:3192:5)
at Browser_mainLoop_runner (blob:http://localhost/71106806-6a35-4454-ad6b-5c83fb187a2d:3127:20)

Application.Quit() not work on iOS

    protected override void RaiseOnCompletedOnDestroy() {
        if (_cancelPingPong != null) {
            _cancelPingPong.Dispose();
            _cancelPingPong = null;
        }

        if (_onRecv != null) {
            _onRecv.OnCompleted();
            _onRecv = null;
        }

        if (!IsConnected)   // Note : Here should be if(IsConnected)
            WebSocket.Close();
    }

disconnect client

Hi I have some questions
1.How we can disconnect the client. I want disconnect client when a user has bad internet connection.
2. Some times disconnect message received with a delay in server side. I close game and it receives after some minutes and some times I get message immediately
3. and after I upgrade to your new version I can't send any message why? I can just connect

Get Json Error

I have an error like this

ArgumentException: JSON parse error: The document root must not follow by other values.
UnityEngine.JsonUtility.FromJson[PollingUrlAnswer] (System.String json) (at C:/buildslave/unity/build/artifacts/generated/common/modules/JSONSerialize/JsonUtilityBindings.gen.cs:25)
socket.io.SocketInitializer+c__Iterator0.MoveNext () (at Assets/Assets/Plugins/socket.io/SocketInitializer.cs:169)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

JSON parse error

all samples not working because json parse exception.

here is call stack
ArgumentException: JSON parse error: The document root must not follow by other values.
UnityEngine.JsonUtility.FromJson[PollingUrlAnswer] (System.String json) (at C:/buildslave/unity/build/artifacts/generated/common/modules/JSONSerialize/JsonUtilityBindings.gen.cs:25)
socket.io.SocketInitializer+c__Iterator0.MoveNext () (at Assets/Plugins/socket.io/SocketInitializer.cs:169)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)
image

maybe json format changed
socketio-unity-jsoninitializer-bug

Object reference not set to an instance of an object

This problem isn't always come but sometimes when it happened, I can't even send any data string. I can't force disconnect and reconnect to refresh the socket. The problem came from WebSocket.GetLastError(). Is anyone know how fix this?

Decoder.cs throw error

When received message: "40/chat,", it throws the error:

IndexOutOfRangeException: Array index is out of range.
socket.io.Decoder.Decode (System.String data) (at Assets/Socket/socket.io/Decoder.cs:45)

Event body wrong parsed

When the event data contains ", " the parse fails. Because is looking for ", " to split it and get eventName and evenData.

If I set on Socket.cs in line 322

pkt.body = "["gameFinished",{"message":"Good job!, play in the new tournament"}]";

Will cause Warning message: gameFinished",{"message":"Good job event doesn't have a handler, because is taking gameFinished",{"message":"Good job as the eventName

Most robust way to separate even name and data should be implemented.

Issue Solved when client get just eventName

When I emit event that is consist of just event name in my node server
socket.emit('version')
Than issue occurs in client because of the parsing problem.
When I check the event using Debug.log()
It looks like ["version"] .
So I change Socket.cs code.
before

                    var seperateIndex = pkt.body.IndexOf(", ");

                    var seperatorLen = 2;
                    if (seperateIndex == -1) {
                        seperateIndex = pkt.body.IndexOf(',');
                        seperatorLen = 1;
                    }

                    var eventName = pkt.body.Substring(2, seperateIndex - 3);
                    if (!_handlers.ContainsKey(eventName)) {
                        Debug.LogWarningFormat("{0} event doesn't have a handler", eventName);
                        break;
                    }

after

                    int seperateIndex = pkt.body.IndexOf(", ");
                    int seperatorLen = 2;
                    if (seperateIndex == -1) {
                        seperateIndex = pkt.body.IndexOf(',');
                        if (seperateIndex == -1) {
                            seperateIndex = pkt.body.Length - 1;
                        }
                        seperatorLen = 1;
                    }
                    string eventName = pkt.body.Substring(2, seperateIndex - 3);
                    if (!_handlers.ContainsKey(eventName)) {
                        Debug.LogWarningFormat("{0} event doesn't have a handler", eventName);
                        break;
                    }
                    if (eventName.Length == pkt.body.Length - 4) {
                        _handlers[eventName]("");
                        break;
                    }

Parsing is not working properly. (And Disconnect issues)

When I intialize a Socket I need to put JSON data in the PollingUrlAnswer class, but it does not parse correctly and I get an error. I eventually parsed the last part of the string.LastIndexOf ('}') method, but I think the code should be fixed.

Other than that, the Disconnect event does not work. Is this a bug?

Socket intitialize를 할 때 PollingUrlAnswer 클래스에 JSON 데이터를 넣어야 하는데(SocketInitializer.cs 파일의 140번째 정도의 줄) 파싱이 제대로 되지 않아 에러가 납니다. 해당 이슈에 대하여 이미 보고된 것을 봤지만 고쳐지지 않은 것 같습니다.
string.LastIndexOf('}') 메소드로 뒷부분을 잘라내서 결국 파싱을 했습니다만 코드가 고쳐져야 하지 않을까 하는 생각이 듭니다.

다른 내용이지만, Disconnect 이벤트가 동작하지 않는데 혹시 버그인가요?

I just updated to 1.1.1, unity3d can't connect to socket.io server.

ENV:
Node.JS: 8.2.1
Node.JS socket.io: 2.0.3
socket.io-client-unity3d: 1.1.1 (download form github release page)
Unity3d: 2017.1.0 f3


Server side i don't change anything.
Node.JS socket.io client can connect socket.io server.
But unity3d 2017.1 + socket.io-client-unity3d 1.1.1 can't connect to server
In this case how to find the solution?

unity3d client code:

Socket io = Socket.Connect ("http://127.0.0.1:7001/game");

throw two errors:

socket.io => socket.io - http://localhost:7001/game got WWW error: 
UnityEngine.Debug:LogErrorFormat(String, Object[])
socket.io.SocketManager:<Update>m__2(Exception) (at Assets/Plugins/socket.io/SocketManager.cs:129)
UniRx.Operators.DoOnError:OnError(Exception) (at Assets/Plugins/UniRx/Scripts/Operators/Do.cs:212)
UniRx.Operators.Timeout:OnError(Exception) (at Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs:110)
UniRx.Operators.FromCoroutine:OnError(Exception) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs:55)
socket.io.<InitCore>c__Iterator0:MoveNext() (at Assets/Plugins/socket.io/SocketInitializer.cs:131)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

WWWErrorException: Exception of type 'UniRx.WWWErrorException' was thrown.
UniRx.InternalUtil.ThrowObserver`1[socket.io.Socket].OnError (System.Exception error) (at Assets/Plugins/UniRx/Scripts/InternalUtil/ListObserver.cs:102)
UniRx.Operators.DoOnCompletedObservable`1+DoOnCompleted[socket.io.Socket].OnError (System.Exception error) (at Assets/Plugins/UniRx/Scripts/Operators/Do.cs:272)
UniRx.Operators.DoOnErrorObservable`1+DoOnError[socket.io.Socket].OnError (System.Exception error) (at Assets/Plugins/UniRx/Scripts/Operators/Do.cs:222)
UniRx.Operators.TimeoutObservable`1+Timeout[socket.io.Socket].OnError (System.Exception error) (at Assets/Plugins/UniRx/Scripts/Operators/Timeout.cs:110)
UniRx.Operators.FromCoroutineObservable`1+FromCoroutine[socket.io.Socket].OnError (System.Exception error) (at Assets/Plugins/UniRx/Scripts/UnityEngineBridge/Operators/FromCoroutine.cs:55)
socket.io.SocketInitializer+<InitCore>c__Iterator0.MoveNext () (at Assets/Plugins/socket.io/SocketInitializer.cs:131)
UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Coroutines.cs:17)

node.js client code:

const io = require('socket.io-client');
const socket = io('http://127.0.0.1:7001/game');

socket.on('connect', () => {
  console.log('connect!');
});

image

Bad Request on localhost

No idea whats going on no matter what I try using the samples I just get 400 bad request. Is this now outdated?

Reconnect after an initial connection failure

I have a scenario where the unity socket.io client might get started before the server is ready for connections ... I would like to have the client code repeatedly attempt connection until a connection is made. I'm having problems figuring out how ... this doesn't work

socket.On(SystemEvents.connectError , (Exception e) => {
	Debug.Log("Socket.io Connection Error: " + e.ToString());
	socket = Socket.Connect(serverUrl);
}

I see changes in the develop branch for disconnect and reconnect ... but when I try and use Socket.Reconnect(socket) I get errors ...

ArgumentException: JSON parse error: The document root must not follow by other values.

I paste code from wiki https://github.com/nhn/socket.io-client-unity3d/wiki/Sample#2-acks-message and run nodejs server and run unity client and in log this error:
ArgumentException: JSON parse error: The document root must not follow by other values.
UnityEngine.JsonUtility.FromJson (System.String json, System.Type type) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:50)
UnityEngine.JsonUtility.FromJson[T] (System.String json) (at C:/buildslave/unity/build/Modules/JSONSerialize/Public/JsonUtility.bindings.cs:33)
socket.io.SocketInitializer+d__21.MoveNext () (at Assets/Plugins/socket.io/SocketInitializer.cs:138)
UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17

My Laptop:
Intel Pentium 2020m
4 GB RAM
Intel® HD Graphics for 3rd Generation Intel® Processors

Is not support HTTPS?

ArgumentException: Unsupported protocol: https
not support https??

https는 지원하지 않는 건가요?
그리고 이건 추가적인 질문인데, AWS의 로드 밸런서를 통과하게 되면 타임아웃 에러가 계속 납니다.

Emit Issues

How can we Emit outside Start()? I try all of the ways to emit in other methods but it's not working
could you please give me an example
this is the way I use socket

static Socket socket;
void Start()
{
socket = Socket.Connect(_networkUrl);
}

public void JoinToGame()
{
socket.Emit("joinToGame", RequestForGame(DB._myId, _myRoom).ToString());
}

run problem:JSON parse error

I tried to run the connection Demo, then meet a problem:
ArgumentException: JSON parse error: The document root must not follow by other values.

the json data revived like this: {"sid":"eADGfUhZX4r8EixPAAAB","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":60000}2:40

so I change the code in class SocketInitializer from:
var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { var json = www.text.Substring(textIndex); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }

to
var textIndex = www.text.IndexOf('{'); if (textIndex != -1) { int lastIndex = www.text.LastIndexOf('}'); int length = lastIndex - textIndex + 1; var json = www.text.Substring(textIndex, length); var answer = JsonUtility.FromJson<PollingUrlAnswer>(json); _urlQueries.Add("sid", answer.sid); }

then the problem has been solved

problem in reconnecting to socketio

hi,
I used this plugin ( dev branch and socket io version is 2) for connecting my game to socket io and handling Listeners and Emit.
so when I disconnect to the server my connection has closed but when i want to reconnect to the server in runtime after disconnecting , i think it cant connect to server correctly.

this is my connection script for this :

socketConnection = Socket.Connect(socketUrl);
            socketConnection.On(SystemEvents.connectError , (Exception e) => {
                Debug.Log("Socket.io Connection Error: " + e.ToString());
                Socket.Reconnect(socketConnection);
            });
            socketConnection.On(SystemEvents.connect, () =>
            {
                Debug.Log("Connected To Server");
                
            });
            socketConnection.On(SystemEvents.reconnect, (int reconnectAttempt) =>
            {
                Debug.Log("Reconnecting : " + reconnectAttempt);
            });
            socketConnection.On(SystemEvents.disconnect, () =>
            {
                Debug.Log("Connection is Closed");
            });

f.e when i connect to server for the first time i have this logs

[Singleton] An instance of socket.io.SocketManager is needed in the scene, so '(singleton) socket.io.SocketManager
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk probed~
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk ping~
socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk pong~
connected to server

but when i want to connect for the seccond time in runtime i just have this

socket.io => ws://localhost:6500/socket.io/?EIO=3&transport=websocket&sid=399_XTZwOOSCQmckAACk probed~

and i should mention this that i test Reconnect after an initial connection failure #34 issue and it couldnt help me

please check it and help me.

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.