Category : websocket

Does anybody know how to write that JS code in JAVA? I don’t want to use Spring or Glassfish or anything, just pure javax.websockets… I need client in java. I have websocket server with @onOpen, @onMessage, @onClose… and threads, but now I need Client. I worked from this example: https://www.pegaxchange.com/2018/01/28/websocket-server-java/ class WebSocketClient { constructor(protocol, hostname, ..

Read more

I try to build a chat application with HTML,JS,CSS with the libraries STOMPJS and SOCKJS as the frontend and Spring Boot as backend. My connect code in the frontend looks like this: function connect() { var socket = new SockJS("http://localhost:8080/chat"); stompClient = Stomp.over(socket); stompClient.connect( {}, function (frame) { console.log("2"); setConnected(true); console.log("Connected: " + frame); stompClient.subscribe("/topic/messages", ..

Read more

After reading the spring official tutorial spinrg.io/guides and docs.spring.io/guides about WebSocket, I have written the code which can send simple messages between client and server. I want to send a file instead of message, and save the file at local path, so I add some functions like send_file and read_file in JavaScript. Client var stompClient ..

Read more