node-red-contrib-nem2 simple chat example template

Description

Flow Image

A simple chat in catapult. The flow consists of two part.

  • One will send a transfer transaction triggered by websocket incoming message.
  • Another will send websocket outgoing message when the listener detect unconfirmed transaction.

note: The listener need to connect first.

Requirements

Mandatory

  • transfer transaction
    • recipient address
  • sign transaction
    • privateKey
  • announce transaction
    • url to a catapult server
  • listener
    • url to a catapult server
    • recipient address

note: need a websocket client

[{"id":"2529cd81.7f6932","type":"tab","label":"chat","disabled":false,"info":""},{"id":"b8cc2893.629598","type":"websocket in","z":"2529cd81.7f6932","name":"","server":"1eb1333e.5939dd","client":"","x":110,"y":100,"wires":[["d1f6320f.16aae","a1b739b3.6a5248"]]},{"id":"bdc90089.b3a3c","type":"websocket out","z":"2529cd81.7f6932","name":"","server":"1eb1333e.5939dd","client":"","x":650,"y":300,"wires":[]},{"id":"a1b739b3.6a5248","type":"debug","z":"2529cd81.7f6932","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":330,"y":40,"wires":[]},{"id":"9e386d68.61f5","type":"transfer","z":"2529cd81.7f6932","name":"","recipient":"","message":"","amount":"0","mosaic":"nem:xem","publicKey":"","network":"acfae53a.044d18","toAggregate":false,"x":210,"y":200,"wires":[["ca639e0.5cdfb6"]]},{"id":"ca639e0.5cdfb6","type":"signTransaction","z":"2529cd81.7f6932","name":"","privateKey":"","coSign":false,"network":"acfae53a.044d18","x":400,"y":200,"wires":[["57381066.fe9c3"]]},{"id":"d1f6320f.16aae","type":"change","z":"2529cd81.7f6932","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"nem.message","tot":"msg"},{"t":"delete","p":"_session","pt":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":100,"wires":[["9e386d68.61f5"]]},{"id":"a1b3eeb8.4661d","type":"debug","z":"2529cd81.7f6932","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"nem","x":780,"y":200,"wires":[]},{"id":"5104d308.70ef4c","type":"listener","z":"2529cd81.7f6932","name":"","server":"bd71983a.4826c8","address":"","listenerType":"unconfirmedAdded","x":180,"y":300,"wires":[["6bb03729.b265b8","11947ac7.e3a6d5"]]},{"id":"11947ac7.e3a6d5","type":"debug","z":"2529cd81.7f6932","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"nem","x":440,"y":360,"wires":[]},{"id":"6bb03729.b265b8","type":"change","z":"2529cd81.7f6932","name":"message","rules":[{"t":"move","p":"nem.transaction.message.payload","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":300,"wires":[["bdc90089.b3a3c","94f83267.4597b"]]},{"id":"94f83267.4597b","type":"debug","z":"2529cd81.7f6932","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":650,"y":360,"wires":[]},{"id":"57381066.fe9c3","type":"announce","z":"2529cd81.7f6932","name":"","server":"bd71983a.4826c8","announceType":"announce","x":600,"y":200,"wires":[["a1b3eeb8.4661d"]]},{"id":"1eb1333e.5939dd","type":"websocket-listener","z":"","path":"/ws/chat","wholemsg":"false"},{"id":"acfae53a.044d18","type":"networkConfig","z":"","network":"MIJIN_TEST","customNetwork":""},{"id":"bd71983a.4826c8","type":"serverConfig","z":"","url":"http://localhost","customUrl":"http://localhost","network":"acfae53a.044d18","port":"3000"}]

Flow Info

Created 6 years, 4 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x4)
  • websocket in (x1)
  • websocket out (x1)
  • websocket-listener (x1)
Other

Tags

  • nem
  • nem2
  • blockchain
  • catapult
  • transfer
  • chat
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option