Company project requirements to have a message reminding mechanism, a variety of considerations with the ACTIVEMQ, basically now the mainstream of the background language is no problem, PHP Phthon Java Nodejs, and so on are no problem, you can go to consult the relevant information, I only paste the front-end code
<template> <div></div></template><script>Import Stomp from "Stompjs"; function uuid () {vars = []; varHexdigits ="0123456789abcdef"; for(vari =0; I < $; i++) {S[i]= Hexdigits.substr (Math.floor (Math.random () *0x10),1); } s[ -] ="4";//bits 12-15 of the Time_hi_and_version field to 0010s[ +] = Hexdigits.substr ((s[ +] &0x3) |0x8,1);//bits 6-7 of the clock_seq_hi_and_reserved tos[8] = s[ -] = s[ -] = s[ at] ="-"; varUUID = S.join (""); returnuuid;} Exportdefault{data () {return{client:Stomp.client ("Ws://192.168.1.103:61614/stomp") }; }, methods: {Afterconnect:frame={ varTOPIC ="/topic/charger.messagetopic"; This. Client.subscribe (Topic, This. Responsecallback, This. onfailed); }, Onfailed:frame={Console.log ("Failed:"+frame); }, Responsecallback:frame={Console.log ("get the message msg=>"+frame.body); Console.log (frame)}, Connect:function () {varOnlyid =uuid (); varheaders = { "Login":"Admin", "Passcode":"Admin", "Client-id": Onlyid,//Additional Header }; This. Client.connect (Headers, This. Afterconnect, This. onfailed); }}, mounted () { This. Connect ()}};</script>
Stompjs WebSocket Vue