mod_websocket icon indicating copy to clipboard operation
mod_websocket copied to clipboard

Error during WebSocket handshake: 'Sec-WebSocket-Protocol' header value 'mqtt' in response does not match any of sent values

Open natarajan050190 opened this issue 10 years ago • 1 comments

Hi, i am trying to connect with the mosquitto server i am getting this response.

2014-12-23 07:29:45: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:29:45: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:29:45: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:29:45: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:29:45: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:29:45: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:29:45: (mod_websocket.c.180) connected 122.178.161.233 : 15966 ( fd = 6 ) -> 127.0.0.1 : 1883 ( fd = 7 ) 2014-12-23 07:29:45: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:29:50: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:29:50: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:29:50: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:29:50: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:29:50: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:29:50: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:29:50: (mod_websocket.c.180) connected 122.178.161.233 : 15968 ( fd = 8 ) -> 127.0.0.1 : 1883 ( fd = 9 ) 2014-12-23 07:29:50: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:29:51: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:29:51: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:29:51: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:29:51: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:29:51: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:29:51: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:29:51: (mod_websocket.c.180) connected 122.178.161.233 : 15976 ( fd = 10 ) -> 127.0.0.1 : 1883 ( fd = 11 ) 2014-12-23 07:29:51: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:30:14: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:30:14: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:30:14: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:30:14: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:30:14: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:30:14: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:30:14: (mod_websocket.c.180) connected 122.178.161.233 : 16001 ( fd = 12 ) -> 127.0.0.1 : 1883 ( fd = 13 ) 2014-12-23 07:30:14: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:30:14: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:30:14: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:30:14: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:30:14: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:30:14: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:30:14: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:30:14: (mod_websocket.c.180) connected 122.178.161.233 : 16002 ( fd = 14 ) -> 127.0.0.1 : 1883 ( fd = 15 ) 2014-12-23 07:30:14: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:30:14: (mod_websocket.c.814) timeout client ( fd = 6 ) 2014-12-23 07:30:14: (mod_websocket_frame.c.245) type = close 2014-12-23 07:30:14: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:30:14: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:30:14: (mod_websocket.c.192) disconnect backend ( fd = 7 ) 2014-12-23 07:30:19: (mod_websocket.c.814) timeout client ( fd = 8 ) 2014-12-23 07:30:19: (mod_websocket_frame.c.245) type = close 2014-12-23 07:30:19: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:30:19: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:30:19: (mod_websocket.c.192) disconnect backend ( fd = 9 ) 2014-12-23 07:30:20: (mod_websocket.c.814) timeout client ( fd = 10 ) 2014-12-23 07:30:20: (mod_websocket_frame.c.245) type = close 2014-12-23 07:30:20: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:30:20: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:30:20: (mod_websocket.c.192) disconnect backend ( fd = 11 ) 2014-12-23 07:30:44: (mod_websocket.c.814) timeout client ( fd = 14 ) 2014-12-23 07:30:44: (mod_websocket_frame.c.245) type = close 2014-12-23 07:30:44: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:30:44: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:30:44: (mod_websocket.c.192) disconnect backend ( fd = 15 ) 2014-12-23 07:30:44: (mod_websocket.c.814) timeout client ( fd = 12 ) 2014-12-23 07:30:44: (mod_websocket_frame.c.245) type = close 2014-12-23 07:30:44: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:30:44: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:30:44: (mod_websocket.c.192) disconnect backend ( fd = 13 ) 2014-12-23 07:31:26: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:31:26: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:31:26: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:31:26: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:31:26: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:31:26: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:31:26: (mod_websocket.c.180) connected 122.178.161.233 : 16070 ( fd = 6 ) -> 127.0.0.1 : 1883 ( fd = 7 ) 2014-12-23 07:31:26: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:31:27: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:31:27: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:31:27: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:31:27: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:31:27: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:31:27: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:31:27: (mod_websocket.c.180) connected 122.178.161.233 : 16073 ( fd = 8 ) -> 127.0.0.1 : 1883 ( fd = 9 ) 2014-12-23 07:31:27: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:31:44: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:31:44: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:31:44: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:31:44: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:31:44: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:31:44: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:31:44: (mod_websocket.c.180) connected 122.178.161.233 : 16088 ( fd = 10 ) -> 127.0.0.1 : 1883 ( fd = 11 ) 2014-12-23 07:31:44: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:31:50: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:31:50: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:31:50: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:31:50: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:31:50: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:31:50: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:31:50: (mod_websocket.c.180) connected 122.178.161.233 : 16094 ( fd = 12 ) -> 127.0.0.1 : 1883 ( fd = 13 ) 2014-12-23 07:31:50: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:31:55: (mod_websocket.c.814) timeout client ( fd = 6 ) 2014-12-23 07:31:55: (mod_websocket_frame.c.245) type = close 2014-12-23 07:31:55: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:31:55: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:31:55: (mod_websocket.c.192) disconnect backend ( fd = 7 ) 2014-12-23 07:31:56: (mod_websocket.c.814) timeout client ( fd = 8 ) 2014-12-23 07:31:56: (mod_websocket_frame.c.245) type = close 2014-12-23 07:31:56: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:31:56: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:31:56: (mod_websocket.c.192) disconnect backend ( fd = 9 ) 2014-12-23 07:32:14: (mod_websocket.c.814) timeout client ( fd = 10 ) 2014-12-23 07:32:14: (mod_websocket_frame.c.245) type = close 2014-12-23 07:32:14: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:32:14: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:32:14: (mod_websocket.c.192) disconnect backend ( fd = 11 ) 2014-12-23 07:32:20: (mod_websocket.c.814) timeout client ( fd = 12 ) 2014-12-23 07:32:20: (mod_websocket_frame.c.245) type = close 2014-12-23 07:32:20: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:32:20: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:32:20: (mod_websocket.c.192) disconnect backend ( fd = 13 ) 2014-12-23 07:32:21: (mod_websocket.c.340) /mqtt is match WebSocket extension: /mqtt 2014-12-23 07:32:21: (mod_websocket_handshake.c.98) allowed origins are not specified 2014-12-23 07:32:21: (mod_websocket.c.538) works as WebSocket-TCP Proxy 2014-12-23 07:32:21: (mod_websocket.c.545) WebSocket Version = 13 2014-12-23 07:32:21: (mod_websocket.c.566) will recv text data from backend 2014-12-23 07:32:21: (mod_websocket.c.152) try to connect backend -> 127.0.0.1 : 1883 2014-12-23 07:32:21: (mod_websocket.c.180) connected 122.178.161.233 : 16106 ( fd = 6 ) -> 127.0.0.1 : 1883 ( fd = 7 ) 2014-12-23 07:32:21: (mod_websocket_handshake.c.398) send handshake response 2014-12-23 07:32:50: (mod_websocket.c.814) timeout client ( fd = 6 ) 2014-12-23 07:32:50: (mod_websocket_frame.c.245) type = close 2014-12-23 07:32:50: (mod_websocket_frame.c.250) payload size = 0x00 2014-12-23 07:32:50: (mod_websocket_frame.c.271) frame size = 0x02 2014-12-23 07:32:50: (mod_websocket.c.192) disconnect backend ( fd = 7 )

my lighttpd config:

websocket.server = ( "/mqtt" => ( "host" => "127.0.0.1", "port" => "1883", "subproto" => "mqttv3.1", "type" => "binary" ) )

Thanks Natarajan

natarajan050190 avatar Dec 23 '14 07:12 natarajan050190

Hi natarajan, Did you succeed to compile and install lighttpd w/ mod_websocket?( https://github.com/nori0428/mod_websocket/issues/41 )

I think that you install lighttpd w/ mod_websocket via apt-get and you use old version. The reason is your configuration is like below,

websocket.server = ( "/mqtt" =>
  (
  "host" => "127.0.0.1",
  "port" => "1883",
  "subproto" => "mqttv3.1",
  "type" => "binary"
  )
)

but error.log shows that mod_websocket is not configured to handle binary frame.

2014-12-23 07:32:21: (mod_websocket.c.566) will recv text data from backend 

And expected log is like below.

(mod_websocket.c.562) will recv binary data from backend 

I can't reproduce your issue in current version.

So, please read INSTALL for making current version and try to make current version or confirm your lighttpd.conf.

Regards.

nori0428 avatar Dec 24 '14 01:12 nori0428