之前写过了白板点阵数据的文章白板点阵数据传输测试初探,做完了数据生成,接下来就改使用Socket.IO
接口进行功能测试了。
这次使用的Socket.IO
框架用的还是以前的,没有发生变化,有兴趣的可以去了解一下:
private static Logger logger = LoggerFactory.getLogger(ST.class)
static int roomId = 44465;
static int activity_id = roomId;
public static void main(String[] args) {
def tbase = getTeaBase()
def sbase = getStuBase()
initAll()
registerAll()
joinRoom(roomId)
BoardUser boardUser = new BoardUser(Users.getTeaUser(0))
List<String> list = boardUser.writeCircle()
teacher.send(EVENT, showWhite(roomId))
teacher.send(EVENT, showWhiteStatus(roomId))
list.each {
teacher.send(EVENT, sendWhiteData(it, roomId))
}
sleep(5.0)
teacher.send(EVENT, showWhite(roomId))
waitForKey(DEFAULT_STRING)
leaveRoom(roomId)
ScoketIOFunClient.closeAll()
}
}
由于数据量太大了,我只截取了一部分具有代表性的。
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,19,-90,-51,20,10,-51,1,44,-51,19,-60,-51,20,60,-51,1,44,-51,19,-30,-51,20,120,-51,1,44,-51,20,20,-51,20,-66,-51,1,44,-51,20,70,-51,21,4,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433777,"roomId":44465},"cmd":"wbDataResponse"}]
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,20,-116,-51,21,84,-51,1,44,-51,20,-26,-51,21,-92,-51,1,44,-51,21,64,-51,21,-22,-51,1,44,-51,21,-72,-51,22,58,-51,1,44,-51,22,48,-51,22,-128,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433778,"roomId":44465},"cmd":"wbDataResponse"}]
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,-116,-125,-24,-128,-127,-27,-72,-120,-23,-101,-74,-23,-101,-74,-23,-101,-74,1,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,98,100,50,55,45,52,97,52,51,48,102,52,55,99,53,98,54,-107,-51,22,-68,-51,22,-68,-51,1,44,-51,23,92,-51,22,-8,-51,1,44,-51,24,6,-51,23,42,-51,1,44,-51,24,-70,-51,23,72,-51,1,44,-51,25,120,-51,23,102,-51,1,44],"pageNo":0,"cmd":"wbData","id":1608883690000433779,"roomId":44465},"cmd":"wbDataResponse"}]
能够正确收到响应消息了。
这里有一个关联接口,就是joinRoom
接口,每次进入改房间的用户,都会收到一个wbFullDataNotify
的通知信息,会把当前房间白板的状态和笔画细节推送给端上。
10:40:00 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"maxId":1608883690000433800,"data":[1,100,-90,115,101,114,118,101,114,-110,-51,4,-80,-51,2,-7,-112,-51,4,-80,-51,2,-7,-111,-39,45,70,117,110,84,101,115,116,101,114,49,54,53,54,52,102,50,101,45,48,49,57,55,45,52,56,52,49,45,-51,1,44,-51,19,-120,-51,19,-100,-51,1,44,-51,19,-120,-51,19,-120,-51,1,44,-51,19,-120,-51,19,-120,-51,1,44],"roomId":44465,"ts":1611196360610},"cmd":"wbFullDataNotify"}]