Test Repository
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

32 lines
1.5 KiB

  1. /* globals module, log */
  2. /**
  3. * Template Socket.IO Connection Middleware for uibuilder.
  4. *
  5. * NOTES & WARNINGS:
  6. * 1) This function is only called ONCE - when a new client connects. So any authentication/security processing is limited
  7. * because you cannot use this to, for example, timeout/extend a session without further server processing of incoming messages.
  8. * 2) Failing to either return or call `next()` will mean that your clients will never connect.
  9. * 3) An error in this function will probably cause Node-RED to fail to start at all.
  10. * 4) You have to restart Node-RED if you change this file.
  11. *
  12. * Allows custom processing for authentication, session management, connection validation, logging, rate limiting, etc.
  13. */
  14. //module.exports = function(socket, next) {
  15. /* Some SIO related info that might be useful in security checks
  16. * console.log('--socket.request.connection.remoteAddress--')
  17. * console.dir(socket.request.connection.remoteAddress)
  18. * console.log('--socket.handshake.address--')
  19. * console.dir(socket.handshake.address)
  20. * console.dir(io.sockets.connected)
  21. */
  22. /*
  23. if ( socket.request.headers.cookie) {
  24. log.info('[uibuilder:Module] io.use - Authentication OK - ID: ' + socket.id)
  25. log.info('[uibuilder:Module] Cookie', socket.request.headers.cookie) // socket.handshake.headers.cookie
  26. return next()
  27. }
  28. next (new Error('UIbuilder:io.use - Authentication error - ID: ' + socket.id ))
  29. */
  30. //}