socketio / socket.io-client-java

Full-featured Socket.IO Client Library for Java, which is compatible with Socket.IO v1.0 and later.
https://socketio.github.io/socket.io-client-java/installation.html
Other
5.32k stars 972 forks source link

How to get all messages from socket.on() listeners into a arraylist #712

Open xtr1993 opened 2 years ago

xtr1993 commented 2 years ago

when i use socket.io-client v1.0.1, i want to collect all the monitored data into an array buut after testing, it is found that the message is added to the array during the listening time, and the final array is still empty

socket.on(Socket.EVENT_MESSAGE, objects -> { String msg = initMsg(objects); linkedList.add(msg); LOGGER.info("receive: {}", initMsg(objects)); });

this code print logs: socket test =====> task_id:309618d1-7b53-4d8a-901e-bf83b28fe9ae, socketAddress: xxx:4100, message:

this end message is empty.

@darrachequesne