import sys

from twisted.internet import reactor
from twisted.python import log
from twisted.web.server import Site
from twisted.web.static import File

from autobahn.websocket import WebSocketServerFactory, \
                               WebSocketServerProtocol

from autobahn.resource import WebSocketResource, HTTPChannelHixie76Aware


class EchoServerProtocol(WebSocketServerProtocol):

   def onMessage(self, msg, binary):
      self.sendMessage(msg, binary)


def run_main_host(kernel, rpc_port):

   debug = True

   factory = WebSocketServerFactory("ws://localhost:".format(rpc_port))

   factory.protocol = EchoServerProtocol

   resource = WebSocketResource(factory)

   ## we server static files under "/" ..
   root = File(".")

   ## and our WebSocket server under "/ws"
   root.putChild("ws", resource)

   ## both under one Twisted Web Site
   site = Site(root)
   reactor.listenTCP(8080, site)

   reactor.run()




@@ -574,15 +574,8 @@
 t:%22.
-format(
 rpc_
@@ -579,17 +579,16 @@
 pc_port)
-)
 %0A%0A   fac

Update webhost.py