mod_websocket
mod_websocket copied to clipboard
lighttpd-1.4.39 (with mod_websocket) is not able to communicate with mqtt broker
Lighttpd started using command - ./lighttpd -D -f websocket.conf Mqtt broker stared using command - ./mosquitto -c mosquitto.conf -v -p 80 Issue - Published message is not visible on webpage URL - http://169.254.80.8:80/index.html
Reference - https://www.ibm.com/developerworks/community/blogs/B-Fool/entry/setting_up_an_mqtt_websocket_gateway_for_raspberry_pi?lang=en
Log from lighttpd server - ./lighttpd -D -f websocket.conf 2016-05-18 10:51:08: (log.c.194) server started 2016-05-18 10:51:08: (server.c.1053) WARNING: unknown config-key: proxy.server (ignored) 2016-05-18 10:51:08: (server.c.1053) WARNING: unknown config-key: proxy.server (ignored) 2016-05-18 10:51:50: (mod_websocket.c.328) /mqttws31.js is match WebSocket extension: /mqtt 2016-05-18 10:51:50: (mod_websocket.c.355) Add log 2016-05-18 10:51:50: (mod_websocket.c.357) upgrade_hdr_value null 2016-05-18 10:51:50: (mod_websocket.c.364) connection_hdr_value NOT null, value = keep-alive 2016-05-18 10:51:50: (mod_websocket.c.387) /mqttws31.js is not WebSocket Request
websocket.conf file
server.document-root = "/debug/javascript_client/mqtt" server.bind = "169.254.80.8" server.port = 80 server.modules += ( "mod_websocket" )
$SERVER["socket"] == "169.254.80.8:443" { server.document-root = "/var/www/ssl" ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/certs/www.example.com.pem" server.name = "ns.example.tld" } websocket.server = ( # for mosquitto # refer to <URL: https://github.com/nori0428/mod_websocket/issues/28> "/mqtt" => ( "host" => "169.254.80.8", "port" => "1883", "type" => "binary", "subproto" => "mqttv3.1" # "proto" => "tcp" ), )
websocket.ping_interval = 5 # send PING per 5 secs websocket.timeout = 300 # disconnect a client when not to recv PONG for 30 secs websocket.debug = 4 # LOG_DEBUG mimetype.assign = ( ".html" => "text/html", ".txt" => "text/plain", ".jpg" => "image/jpeg", ".png" => "image/png", ".js" => "text/javascript" ) index-file.names = ( "index.html", "index.php" )