Category Archives: General

Secure websocket server using autobahn and trollius (asyncio)

Websockets are a pretty useful way of passing information to and from clients.  But how do you make them secure?  I’m documenting how I’m figuring it out as I go.  Let’s get started.

First, let’s get a simple autobahn server and client up and running.  This is straight from the asyncio example on github.  Running it with python and python respectively.

To make things secure, first we need to create some keys and certificates.  I am creating a self-signed certificate and key for both the server and the test client:

Next we need to add a few lines to our server and client.  For the server add:

sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
sslcontext.load_cert_chain(‘server.crt’, “server.key”)
and when we create the server, we will pass in the context.  Find the “loop.create_server” line and change it to:
coro = loop.create_server(factory, ‘’, 9000, ssl=sslcontext)
The client is almost identical:
sslcontext = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
sslcontext.load_cert_chain(‘client.crt’, “client.key”)
coro = loop.create_connection(factory, ‘’, 9000, ssl=sslcontext)
That’s it!

Using yocto combo layers and adding a new layer

It’s easy to add your own layer using the combo layer system.

  1. Edit conf/combo-layers.conf and add a section for your layer.
  2. cp conf/combo-layers-local-sample.conf to conf/combo-layers-local.conf and add a section for your new layer
  3. run scripts/combo-layer init
  4. after you have a build directory (by sourcing oe-init-build-env) edit build/conf/bblayers.conf and add your layer
  5. bitbake as per normal


Super Dock Qi Upgrade Video

The “Super Dock” is a dock for my moto x (2014) phone that has a giant 4200mAh battery in it.  It keeps my phone charged for a few days instead of just 10-12 hours.

I made the dock several months ago.  It consists of 2 parts.  The first part is the actual dock.  It’s molded so that the moto x just snaps into it.  It has a USB plug at the bottom to charge the phone.

The second part is the cover.  It is molded to fit around the dock and protect the battery and circuit.  It fits snugly on the dock part and the bottom of the phone.

Here’s the video: