当用户加入多个房间,离开其中的某个房间以后,sfs.activeRoomId不会改变的,仍然是最后加入的那个房间的编号,当那个房间被destroy了以后,setUserVariable就会发生问题,从server端的数据可以看到user.activeRoomId的数据是正确的,切换到了之前的房间编号,但是客户端的数据没有改变。
因此需要自己接收onRoomLeft事件,当用户离开某个房间的时候,检查一下sfs.activeRoomId的数据是否有问题。
document:
getActiveRoom
Get the currently active
Room object.
SmartFoxServer allows users to join two or more rooms at the same time (multi-room join). If this feature is used, then this method is useless and the application should track the various room id(s) manually, for example by keeping them in an array.
SmartFoxServer allows users to join two or more rooms at the same time (multi-room join). If this feature is used, then this method is useless and the application should track the various room id(s) manually, for example by keeping them in an array.