Advertisement
Guest User

Untitled

a guest
May 28th, 2019
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.75 KB | None | 0 0
  1. [{"id":"20a6df72.cfb7","type":"websocket in","z":"6b0f06a8.242358","name":"","server":"372fe06c.69489","client":"","x":190,"y":620,"wires":[["4b02cb65.c5d7d4","8e5d5c89.ff771"]]},{"id":"f58b80a5.7729f","type":"http in","z":"6b0f06a8.242358","name":"","url":"/testWebsockets","method":"get","upload":false,"swaggerDoc":"","x":180,"y":700,"wires":[["aa62aefe.f4d45"]]},{"id":"aa62aefe.f4d45","type":"template","z":"6b0f06a8.242358","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n <head>\n <script>\n var connection = new WebSocket('ws://192.168.0.111:1880/ws/testWebsockets', ['soap', 'xmpp']);\n // When the connection is open, send some data to the server\n connection.onopen = function () {\n connection.send('Ping'); // Send the message 'Ping' to the server\n };\n\n // Log errors\n connection.onerror = function (error) {\n console.log('WebSocket Error ' + error);\n };\n\n // Log messages from the server\n connection.onmessage = function (e) {\n var temp = JSON.parse(e.data);\n\t\t\t\tif(temp.topic === \"numero\")\n\t\t\t\t{\n\t\t\t\t\tdocument.getElementById(\"asd\").innerHTML = Date(datos.payload).toString();\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tdatos = temp;\n\t\t\t\t\tconsole.log(datos);\n\t\t\t\t}\n\t\t\t};\n\n function enviar()\n {\n connection.send(\"prueba\");\n\t\t\t\t//connection.send(\"123\");\n }\n </script>\n </head>\n <body>\n <div id=\"asd\"></div>\n <button onClick=\"enviar()\">enviar</button>\n \n </body>\n</html>","output":"str","x":400,"y":700,"wires":[["1579741c.12148c"]]},{"id":"53e87418.af02bc","type":"websocket out","z":"6b0f06a8.242358","name":"","server":"372fe06c.69489","client":"","x":630,"y":620,"wires":[]},{"id":"4b02cb65.c5d7d4","type":"function","z":"6b0f06a8.242358","name":"","func":"msg.payload = \"apretaste el botón\";\nreturn msg;","outputs":1,"noerr":0,"x":410,"y":620,"wires":[["53e87418.af02bc"]]},{"id":"1579741c.12148c","type":"http response","z":"6b0f06a8.242358","name":"","statusCode":"","headers":{},"x":570,"y":700,"wires":[]},{"id":"8e5d5c89.ff771","type":"debug","z":"6b0f06a8.242358","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":390,"y":580,"wires":[]},{"id":"65b3ae3f.1c5a9","type":"inject","z":"6b0f06a8.242358","name":"","topic":"numero","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":360,"y":660,"wires":[["53e87418.af02bc"]]},{"id":"372fe06c.69489","type":"websocket-listener","z":"","path":"/ws/testWebsockets","wholemsg":"true"}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement