@drasko <<< how does Streembit does PUB/SUB >>> it's a bit complicated :-)
The streembit-lib kadlib module manages the PUB/SUB
From the UI standpoint the streembitui project at https://github.com/streembit/streembitui is the source. The particular file is https://github.com/streembit/streembitui/blob/master/assets/js/streembit/peercomm.js
For instance the publish public key function is "module.publish_user". That tells the world and your contacts what is your public key.
I suggest to run the SDK version of node-webkit and then push F12 to get the developer console and then you can debug the application. I will share my screen sometimes to explain the dev environment and we can go through on the project structure.
Sorry Drasko for not noticing your message earlier, on time again.