이 라이브러리는 웹 브라우저 및 Node.js 응용 프로그램의 WebSocket 클라이언트에 대한 스톰프를 제공합니다.
가이드, FAQ 및 API 문서는 https://stomp-js.github.io/를 방문하십시오.
이 라이브러리를 사용하면 WebSocket을 통해 스톰 브로커에 연결할 수 있습니다. 이 라이브러리는 모든 현재 프로토콜 변형을 포함한 완전한 스톰프 사양을 지원합니다. 가장 인기있는 메시징 브로커는 Box 외부 웹 사이트 또는 플러그인을 사용하여 Stomp 및 Stomp를 지원합니다.
<!--
JSPM Generator Import Map
Edit URL: https://generator.jspm.io/#U2NgYGBkDM0rySzJSU1hcCguyc8t0AeTWcUO5noGega6SakliaYAYTzJAykA
-->
< script type =" importmap " >
{
"imports" : {
"@stomp/stompjs" : "https://ga.jspm.io/npm:@stomp/[email protected]/esm6/index.js"
}
}
</ script >
<!-- ES Module Shims: Import maps polyfill for modules browsers without import maps support (all except Chrome 89+) -->
< script
async
src =" https://ga.jspm.io/npm:[email protected]/dist/es-module-shims.js "
crossorigin =" anonymous "
> </ script >
< script type =" module " >
import { Client } from '@stomp/stompjs' ;
const client = new Client ( {
brokerURL : 'ws://localhost:15674/ws' ,
onConnect : ( ) => {
client . subscribe ( '/topic/test01' , message =>
console . log ( `Received: ${ message . body } ` )
) ;
client . publish ( { destination : '/topic/test01' , body : 'First Message' } ) ;
} ,
} ) ;
client . activate ( ) ;
</ script >
$ npm install @stomp/stompjs ws
import { Client } from '@stomp/stompjs' ;
import { WebSocket } from 'ws' ;
Object . assign ( global , { WebSocket } ) ;
const client = new Client ( {
brokerURL : 'ws://localhost:15674/ws' ,
onConnect : ( ) => {
client . subscribe ( '/topic/test01' , message =>
console . log ( `Received: ${ message . body } ` )
) ;
client . publish ( { destination : '/topic/test01' , body : 'First Message' } ) ;
} ,
} ) ;
client . activate ( ) ;
API 문서는 STOMPJS 패밀리 라이브러리의 GitHub 페이지로 호스팅됩니다. 당신은 https://stomp-js.github.io/api-docs/latest/로 곧장 향할 수 있습니다.
이 라이브러리에는 자세한 사용 지침이 제공됩니다. 사용 지침에서 찾으십시오. https://stomp-js.github.io/에서 다른 안내서를 확인하십시오.
매우 자세한 API 문서가 있습니다. https://stomp-js.github.io/api-docs/latest/classes/classes/client.html에서 시작해야합니다.
이 라이브러리의 이전 버전을 사용하는 경우 코드를 변경해야합니다. 업그레이드로 이동하십시오.
https://github.com/stomp-js/rx-stomp는이 라이브러리를 기반으로 하며이 라이브러리가 제공하는 전체 기능을 RXJS Observables로 노출시킵니다.
NPM 패키지에는 TypeScript 정의가 포함되어 있으므로 별도로 설치할 필요가 없습니다.
변경 로그를 방문하십시오.
코드를 이해하려면 개발하거나 기여합니다. 기여 방법을 방문하십시오.
라이센스 -Apache -2.0