728x90 반응형 Websocket1 websocket 설정( js, spring boot) front end (js) 1. npm install npm i sockjs-client npm i stompjs 2. connect하는 js 파일 import SockJS from "sockjs-client"; import Stomp from "stompjs"; var stompClient = null; export function connect() { const headers = { // connect, subscribe에 쓰이는 headers }; var socket = new SockJS(`/ws`); stompClient = Stomp.over(socket); stompClient.connect( headers, frame => { stompClient.subscribe( "", () => { .. 2021. 3. 31. 이전 1 다음 728x90