:: [Libbitcoin] Direct websockets serv…
Top Pagina
Delete this message
Reply to this message
Auteur: Amir Taaki
Datum:  
Aan: libbitcoin
Onderwerp: [Libbitcoin] Direct websockets server
I've been playing today with websocketpp, which only depends on boost
and is still actively developed.
It's simple to use and asynchronous (based off boost ASIO) which makes
it ideal.

Here's what I used on Ubuntu 13.10 to compile it:

export BOOST_INCLUDES=/usr/include/
export BOOST_LIBS=/usr/lib/x86_64-linux-gnu/
scons
cd build/release/echo_server/
./echo_server

In another terminal window:

sudo pip install websocket-client

Create test.py and run it:

from websocket import create_connection
ws = create_connection("ws://localhost:9002/")
print "Sending 'Hello, World'..."
ws.send("Hello, World")
print "Sent"
print "Reeiving..."
result = ws.recv()
print "Received '%s'" % result
ws.close()

Other options:

* QtWebSockets - not sure where it's used or how well developed it is.
* libwebsockets - "lightweight pure C library built to use minimal CPU
and memory resources, and provide fast throughput in both directions."

libwebsockets seems very cool, especially the zero-copy write but it
looks more complex to use:
http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/tree/test-server/test-echo.c

here's websocketpp for comparison:
https://github.com/zaphoyd/websocketpp/blob/master/examples/echo_server/echo_server.cpp

websocketpp should be easy to natively integrate as a transport into
libbitcoin-server.