EzDevInfo.com

websockify

Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service. Implementations in Python, C, Node.js and Ruby.

How do I run websockify on linux?

I've downloaded websockify, but now I don't know how to run it.


Source: (StackOverflow)

How to use websockify with python on windows or compiling websockify as windows executable (for more multiple client connection at a time)

I'm trying to get the websockify 0.6.0 running on windows but without any luck,

I have tried python websockify.py 1501 10.0.0.141:1501 but its not good, getting errors , like that:

Traceback (most recent call last): File "websockify.py", line 1, in <module> run NameError: name 'run' is not defined

I also tried Compiling Websockify as Windows Executable , but this also didn't work I use the following command run.exe 1501 10.0.0.141:1501 and it looks promising at the beginning, outputting the following to the console:

WARNING: no 'resource' module, daemonizing is disabled WebSocket server settings: - Listen on :1501 - Flash security policy server - No SSL/TLS support (no cert file) - proxying from :1501 to 10.0.0.141:1501

but then after trying to connect using the following from the browser ws://localhost:1501

**it outputs the following error

Traceback (most recent call last): File "run", line 5, in <module> File "websockify\websocketproxy.pyc", line 419, in websockify_init File "websockify\websocket.pyc", line 1018, in start_server UnboundLocalError: local variable 'exc' referenced before assignment


Any idea on how to use the websockify on wondows / or how to use the compiled websockify as windows executable ?


Source: (StackOverflow)

Advertisements

How to use Javascript blob that actually contains ASCII text?

I am connecting to a JSON-RPC server from an HTML5 page, via websockify.

I am basing my code on the canonical websocket echo example. Pseudocode follows:

In the HTML part:

<P id="testview"></P>

In the script part:

el = document.getElementById("testview");
var sock = new WebSocket("ws://localhost:5555", ['binary'] );
sock.onopen = function(evt) { onOpen(evt) };      // sends request
sock.onmessage = function(evt) { el.innerHTML = evt.data; }

Eventually I would like to JSON parse the result but a first step would be to be able to display it unparsed.

However currently the display produced in el by this code is [Object BLOB].

How do I make it display { "method" : "blabla", etc., i.e. the actual content of the received data (which is human-readable ASCII).

The output of console.log(evt.data) is:

Blob {}
  size: 74
  type: ""
  __proto__: Blob
    constructor: Blob() { [native code] }
    size: (...)
    get size: () { [native code] }
    slice: slice() { [native code] }
    type: (...)
    get type: () { [native code] }
    __proto__: Object

If I change the WebSocket to open as ['base64'] instead of binary, and I base64-encode my request, then I get back a base64 string which I am able to work with. However this seems like a waste of bandwidth and encoding compared to just sending and receiving plain ASCII which JSON-RPC is.

NB. Any alternative suggestions as to how to talk to JSON-RPC from HTML5 are welcome too.


Source: (StackOverflow)

websockify, noVNC in wrap mode

I need to convert a web page requiring viewing a X window from using the VncViewer applet to some HTML5 based VNC client. The worry is NSAPI will get desupported in the near future on browsers (mainly Chrome) that disables applet functions.

I looked at noVNC and websockify and got it to work. But, here is my problem: We still have some client on IE8 that does not support Canvas. For those clients which has Java enabled and won't be changing to a higher version of IE or Chrome, we still want them to keep running the applet version. By running websockify in the wrap mode, it seems I can no longer directly connect to the VNC server (not through websockify) to keep those applet clients functional.

e.g. My command to run websockify is: run 5903 --wrap-mode=ignore -- vncserver -geometry 1024x768 :3

After this, I tried to use the regular VNCViewer client to connect to port 5903, and it's rejected. Only the websockified page can view the VNC window. If I change the 5903 to 5902, then I can use the regular VNCViewer client to view window at 5903, however the websockified page can't view it at 5902.

Is there a hope to keep concurrent connection to my VNC server available (websockify and regular connections)?

Thank!


Source: (StackOverflow)

novnc: How to run websockify automatically

Maybe someone can help me with novnc. I want to use the novnc service, so I installed it on a debian machine with debian packages. I am able to manually establish a vnc session over a proxy server to another vnc server. But currently I have to manually start the websockify service on my proxy.

How can I start this service automatically? And if the user finished his session how do I tell the proxy server to close the session? I only want to use novnc without the whole openstack installation.

In addition the service should run for multiple users. For example user1 should connect to proxy-ip:5901 and user2 should connect to proxy-ip:5902. So I need to start the websockify service on different ports at the same time.


Source: (StackOverflow)