Unity WebSockets MMORoom creation troubles
Posted: 30 Sep 2016, 12:01
Hi,
I have some problems when i send a room creation request to the server.
With TCP protocol all work fine but when i switch to WS protocol i have the following exception on server.
13:39:54,192 WARN [SFSWorker:Sys:2] v290.SystemReqController - java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
com.smartfoxserver.v2.entities.data.SFSArray.getInt(SFSArray.java:281)
com.smartfoxserver.v2.entities.data.SFSObjectLite.getIntArray(SFSObjectLite.java:103)
com.smartfoxserver.v2.controllers.system.CreateRoom.preProcess(CreateRoom.java:220)
com.smartfoxserver.v2.controllers.system.CreateRoom.execute(CreateRoom.java:264)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:157)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:114)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.bitswarm.websocket.WebSocketProtocolCodec.dispatchRequest(WebSocketProtocolCodec.java:139)
com.smartfoxserver.bitswarm.websocket.WebSocketProtocolCodec.onPacketRead(WebSocketProtocolCodec.java:65)
com.smartfoxserver.bitswarm.websocket.netty.WebSocketServerHandler$WSIOExecutor.run(WebSocketServerHandler.java:105)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:722)
I have found the reason of the exception, the server wait for an integer DefaultAoi when i use WebSockets.
I tried to send integer values for the MMORoomSetting.DefaultAoI but when i call the MMOAPi.SetUserPosition on server, i have troubles too:
com.smartfoxserver.v2.exceptions.SFSRuntimeException: Provided position doesn't match coordinate type used in [ MMORoom: District_01, Id: 1, Group: default, AOI: ( 10, 10, 0) ]. Expected: Int, Found: Float
So i tried to set user position for the MMO Api with integer value (it work but it is not really good :/).
Now my room be correctly created and i can use the AoI but when i receive users positions in the OnUserVariablesUpdate, i have client-side exception due to invalid cast when i use SFSUserVariable.GetDouble() to get position of a remote user.
All work fine when i use TCP protocol but i have real difficulties to make my game work with WebSockets.
The code i use is the same as the MMORoomDemo.
Thanks for your help.
I have some problems when i send a room creation request to the server.
With TCP protocol all work fine but when i switch to WS protocol i have the following exception on server.
13:39:54,192 WARN [SFSWorker:Sys:2] v290.SystemReqController - java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
com.smartfoxserver.v2.entities.data.SFSArray.getInt(SFSArray.java:281)
com.smartfoxserver.v2.entities.data.SFSObjectLite.getIntArray(SFSObjectLite.java:103)
com.smartfoxserver.v2.controllers.system.CreateRoom.preProcess(CreateRoom.java:220)
com.smartfoxserver.v2.controllers.system.CreateRoom.execute(CreateRoom.java:264)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:157)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:114)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.bitswarm.websocket.WebSocketProtocolCodec.dispatchRequest(WebSocketProtocolCodec.java:139)
com.smartfoxserver.bitswarm.websocket.WebSocketProtocolCodec.onPacketRead(WebSocketProtocolCodec.java:65)
com.smartfoxserver.bitswarm.websocket.netty.WebSocketServerHandler$WSIOExecutor.run(WebSocketServerHandler.java:105)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:722)
I have found the reason of the exception, the server wait for an integer DefaultAoi when i use WebSockets.
I tried to send integer values for the MMORoomSetting.DefaultAoI but when i call the MMOAPi.SetUserPosition on server, i have troubles too:
com.smartfoxserver.v2.exceptions.SFSRuntimeException: Provided position doesn't match coordinate type used in [ MMORoom: District_01, Id: 1, Group: default, AOI: ( 10, 10, 0) ]. Expected: Int, Found: Float
So i tried to set user position for the MMO Api with integer value (it work but it is not really good :/).
Now my room be correctly created and i can use the AoI but when i receive users positions in the OnUserVariablesUpdate, i have client-side exception due to invalid cast when i use SFSUserVariable.GetDouble() to get position of a remote user.
All work fine when i use TCP protocol but i have real difficulties to make my game work with WebSockets.
The code i use is the same as the MMORoomDemo.
Thanks for your help.