Git Product home page Git Product logo

wss's Introduction

WSS

WebSocket to TCP Gateway

WSS is a WebSocket to TCP Gateway that was originally created to connect mosquitto.js to an MQTT broker. It creates a WebSocket server and forwards any WebSocket traffic to a TCP Server. For every new WebSocket connection a TCP connection to the destination server is created and bound to the corresponding WebSocket connection. This results in a 1:1 mapping of WebSocket and TCP connections and ensures that the responses of the TCP server arrive at the original WebSocket client.

The goal was initially to create a bridge that is content INsensitive and only transmits the traffic AS IT IS from the broker to websocket clients (and reverse). However, this approach is not ideal for MQTT as some JavaScript clients (including the reference implementation from Paho) can't handle multiple MQTT messages arriving at once (or fragmented messages arriving partly) in a WebSocket message. In the mqtt branch of WSS is a version that reads the MQTT header and determins the length of the message. It uses that information to send exactly ONE MQTT message to the WebSocket client so that the JS libraries won't have problems.

The Websocket server uses version 0.2 of websocket++ (https://github.com/zaphoyd/websocketpp/tree/0.2.x) and the Boost C++ Libraries (http://www.boost.org/).

It was developed using the eclipse IDE. The project configuration assumes that the boost and websocket++ header files and libraries are located in /usr/local/include and /usr/local/lib respectively. For boost headers and libs is searched in /usr/include and /usr/lib. If that doesn't match your setup just edit the eclipse project properties or build manually.

Manual build: To create an executale that uses shared libraries run

g++ -o WSS_shared -I/usr/local/include -L/usr/local/lib -lpthread -lboost_program_options -lboost_regex -lboost_thread -lboost_system -lwebsocketpp src/WSS.cpp -O3 -Wall

Make sure that you have all symlinks you need from libwebsocketpp.so.* to libwebsocketpp.so and to libwebsocketpp.so.0 and that the LD_LIBRARY_PATH contains the shared libraries when you execute the program. To create a static linked executable run

g++ -o WSS_static src/WSS.cpp -I/usr/local/include /usr/local/lib/libwebsocketpp.a /usr/lib/libboost_thread.a /usr/lib/libboost_regex.a /usr/lib/libboost_system.a /usr/lib/libboost_program_options.a -lpthread -O3 -Wall

wss's People

Contributors

stylpen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wss's Issues

Trouble with Paho JS to WSS on Chrome

Sorry to bug you again, but I'm way over the top trying to understand this.

Chrome browsers using Paho's mqttws31.js don't seem to be able to talk to WSS. There was some conversation between @binarybucks and myself on Twitter last night, but I just don't understand what's happening. @binarybucks says he had to modify homA's paho.js in order to get it to work, but that is IMO not a viable solution.

Case in point is me wanting to distribute HiveMQ's MQTT 'browser" which uses Paho.

I've created what I think is a minimal test-case at https://github.com/jpmens/paho-t-1. The README describes the Web browsers which work, and those I've tested which don't. It seems to me it's Chrome only.

If and when you have a moment, I'd appreciate you looking at that. It would be grand to have WSS compliant with Chrome.

Oh, and in case you hadn't noticed: I haven't a clue on what's going on... :-|

Support for SSL/TLS

Would you consider adding TLS support to WSS for Paho JS to connect securely?

Broker installation

Hello, I was wondering if you could help me a bit in the installation process of this promissing WebSocket MQTT-aware.

This is what I'm doing:
'yum install boost'

Then I installed websocketpp [https://github.com/zaphoyd/websocketpp/wiki/Build-on-debian]

After that, I clone your repository and launched:
g++ -o WSS_static src/WSS.cpp -I/usr/local/include /usr/local/lib/libwebsocketpp.a /usr/lib/libboost_thread.a /usr/lib/libboost_regex.a /usr/lib/libboost_system.a /usr/lib/libboost_program_options.a -lpthread -O3 -Wall

But the commands ends with a lot of errors I don't understand.

What do you suggest me, to try to overcome these problems or just move to lighttpd + mod_websockets?

Thanks in advance

Trying to build your gateway

Hi Stephan:
I would like to switch from mod_websocket and use your gateway.

I have built websocketpp following this link: https://github.com/zaphoyd/websocketpp/wiki/Build-on-debian

When I tried to build your gateway I ran into error.

Here are the last two lines of output:
WSS.cpp: ... : undefined reference to `websocketpp::processor::hybi_header::reset()'
collect2: error: ld returned 1 exit status

Could you please give me some hint what to do next? I would really appreciate it

Statically linked binary?

@stylpen I'm looking for a statically linked version of WSS for use on Debian 7.3 for our OwnTracks appliance.

While some of the versions in the branches here are called WSS_static, they aren't statically linked:

WSS_static_x86_Linux: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xe25c1d541688579d41401d6be37559f09cbf9300, not stripped

Any chance you can build a really static executable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.