Test Repository
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

28 linhas
1.3 KiB

  1. /* globals module, log */
  2. /**
  3. * Template Socket.IO Use Middleware for uibuilder.
  4. *
  5. * NOTES & WARNINGS:
  6. * 1) This function is called when a client sends a "packet" if data to the server.
  7. * 2) Failing to either return or call `next()` will mean that your clients will never be able to get responses.
  8. * 3) An error in this function will probably cause Node-RED to fail to start at all.
  9. * 4) You have to restart Node-RED if you change this file.
  10. * 5) If you call `next( new Error('blah') )` The error is sent back to the client and further proessing of the incoming msg stops.
  11. *
  12. * Allows you to process incoming data from clients.
  13. *
  14. * @see also https://cheatsheetseries.owasp.org/cheatsheets/HTML5_Security_Cheat_Sheet.html#websocket-implementation-hints
  15. *
  16. * @param {*} msg The msg send by a client (Socket.IO calls it a "packet")
  17. * @param {function} next The callback to hand off to the next middleware
  18. */
  19. // module.exports = function(msg, next) {
  20. // //if (not some kind of error) {
  21. // console.log('Socket.IO:sioUse.js - msg from client: ', msg)
  22. // return next()
  23. // //} else {
  24. // // The error is sent back to the client and further processing of the msg stops
  25. // // next(new Error('Oops! Some kind of error happened'))
  26. // //}
  27. // }