iosswiftsmartfoxserver

Smartfox iOS - Cannot join room


Here is my RoomSettings

let roomSettings = RoomSettings(name: "room \(rooms.count + 1)")
roomSettings.maxUsers = 10
smartFox.send(CreateRoomRequest(roomSettings: roomSettings, autoJoin: false, roomToLeave: nil))

Join room request

func joinRoom(room : Room, callback : (Result -> ())?)
{
    pendingCallbacks[TaskType.JoinRoom] = callback
    smartFox.send(JoinRoomRequest(id: room.id()))
}

After the room is created, I click on it to join but strange exception occurs and i really don't know what happens

21:07:18,545 ERROR [SFSWorker:Sys:4] v290.SystemReqController     - Cannot find a controller command for request ID: 3
21:07:18,546 WARN  [SFSWorker:Sys:4] v290.SystemReqController     - java.lang.NullPointerException
java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1124)
com.smartfoxserver.v2.controllers.v290.SystemReqController.processRequest(SystemReqController.java:146)
com.smartfoxserver.v2.controllers.v290.SystemReqController.enqueueRequest(SystemReqController.java:119)
com.smartfoxserver.bitswarm.io.protocols.AbstractProtocolCodec.dispatchRequestToController(AbstractProtocolCodec.java:39)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.dispatchRequest(SFSProtocolCodec.java:133)
com.smartfoxserver.v2.protocol.SFSProtocolCodec.onPacketRead(SFSProtocolCodec.java:90)
com.smartfoxserver.v2.protocol.binary.BinaryIoHandler$1.run(BinaryIoHandler.java:477)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
java.lang.Thread.run(Thread.java:745)

Could you tell me how to resolve this problem ?

I use smartfox server 2.10.0 and smartfox client ObjC 1.6.0


Solution

  • Maybe there is something wrong with the client api, I cannot use the Room Id to join and leave room (If i use room id, that exception will occur). Even though, smartfox document said it's possible.

    Now by changing room id to room name in JoinRoomRequest, everything works well