توفر هذه المكتبة مجموعة من عميل WebSocket لتطبيقات متصفح الويب وتطبيقات Node.js.
يرجى زيارة https://stomp-js.github.io/ للحصول على أدلة ، الأسئلة الشائعة ومستندات API.
تتيح لك هذه المكتبة الاتصال بوساطة STOMP عبر WebSocket. تدعم هذه المكتبة مواصفات STOMP الكاملة بما في ذلك جميع متغيرات البروتوكول الحالية. يدعم أكثر سماسرة المراسلة الأكثر شعبية STOMP و STOMP عبر WebSockets خارج الصندوق أو باستخدام الإضافات.
<!--
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 كصفحات github لعائلة المكتبات StompJS. يمكنك التوجه مباشرة إلى https://stomp-js.github.io/api-docs/latest/
تأتي هذه المكتبة مع تعليمات الاستخدام التفصيلية. يرجى العثور عليه في تعليمات الاستخدام. تحقق من أدلة أخرى على https://stomp-js.github.io/.
هناك وثائق API مفصلة تمامًا ، يجب أن تبدأ في https://stomp-js.github.io/api-docs/latest/classes/client.html.
إذا كنت تستخدم إصدارًا أقدم من هذه المكتبة ، فستحتاج إلى إجراء تغييرات على الكود الخاص بك. توجه إلى الترقية.
https://github.com/stomp-js/rx-stomp يعتمد على هذه المكتبة ويكشف الوظائف بأكملها التي توفرها هذه المكتبة كملاحظات RXJS.
تتضمن حزمة NPM تعريفات TypeScript ، لذلك ليست هناك حاجة لتثبيتها بشكل منفصل.
يرجى زيارة سجل التغيير.
إذا كنت تريد فهم الكود أو تطوير أو المساهمة. يرجى زيارة كيفية المساهمة.
ترخيص - Apache -2.0