novnc / websockify

Websockify is a WebSocket to TCP proxy/bridge. This allows a browser to connect to any application/server/service.
GNU Lesser General Public License v3.0
3.88k stars 768 forks source link

Incompatibility with websockify 0.7 #223

Closed ramonmedeiros closed 8 years ago

ramonmedeiros commented 8 years ago

Hi,

I was using websockify 0.5, then, i update it to 0.7 and found this issue:

Traceback (most recent call last): File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap self.run() File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run self._target(_self._args, *_self._kwargs) File "/usr/lib/python2.7/site-packages/wok/plugins/kimchi/vnc.py", line 52, in start_proxy server = WebSocketProxy(params) File "/usr/lib/python2.7/site-packages/websockify-0.7.0-py2.7.egg/websockify/websocketproxy.py", line 250, in init websocket.WebSocketServer.init*(self, RequestHandlerClass, _args, _kwargs) TypeError: init() got an unexpected keyword argument 'target_cfg'

I just saw the class was changed by this commit e0d69bb4cb18d29cfaf48165144ce197e8c8c20e, so, how i can change this now? Here is how i'm using today:

https://github.com/kimchi-project/kimchi/blob/master/vnc.py#L46-L53

DirectXMan12 commented 8 years ago

The target_cfg parameter has now become the token_plugin parameter. You'll need to instantiate an instance of the token plugin you want to use (in this case, probably the TokenFile plugin (https://github.com/kanaka/websockify/blob/master/websockify/token_plugins.py#L46), and pass that.

Using token_plugin also allows you to write your own logic to lookup tokens, so you could also hypothetically skip the file-based method and lookup your tokens directly in your backend (if you're set up to do that). You can find more information on that here: https://github.com/kanaka/websockify/wiki/Token-based-target-selection#custom-plugins.