Testing Whiteboard Data Transmission with Socket.IO: A Step‑by‑Step Script Guide
This article walks through using Socket.IO to test whiteboard pixel data transmission, presenting a Java test script, sample console logs, and an explanation of the joinRoom interface that pushes full board state to connected clients.
Overview
This article demonstrates how to use the Socket.IO framework to perform functional testing of the whiteboard pixel‑data transmission interface. The same Socket.IO client library version from previous examples is used, and a ready‑to‑run Java test script is provided.
Test Script
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();
}Console Output
Only a representative portion of the large payload is shown. The logs confirm that the client receives the expected wbDataResponse messages.
10:31:49 INFO org.slf4j.Logger$info$0.call(Unknown Source) - 老师:61951375269 收到响应:[{"msg":"SUCCESS","code":0,"data":{"data":[1,3,-78,-24,...],"pageNo":0,"cmd":"wbData","id":1608883690000433777,"roomId":44465},"cmd":"wbDataResponse"}]
... (additional similar log entries) ...Business‑Related Interface Verification
The joinRoom API triggers a wbFullDataNotify notification for each user entering the room. This notification pushes the current whiteboard state and drawing details to the client.
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,...],"roomId":44465,"ts":1611196360610},"cmd":"wbFullDataNotify"}]Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
