Did I find the right examples for you? yes no

All Samples(7)  |  Call(5)  |  Derive(0)  |  Import(2)
Listen on a port and delegate the accepted connection to a WebSocketLocalProxyHandler

src/w/s/wstunnel-0.0.3/wstunnel/factory.py   wstunnel(Download)
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
from wstunnel import join_url
from wstunnel.client import WSTunnelClient, WebSocketProxy
from wstunnel.server import WSTunnelServer
from wstunnel.toolbox import address_to_tuple
 
        srv.add_proxy(key=settings["port"],
                      ws_proxy=WebSocketProxy(port=int(settings["port"]),
                                              ws_url=join_url(ws_url, resource),
                                              filters=filters))

src/w/s/wstunnel-0.0.3/wstunnel/test/test_wstunnel.py   wstunnel(Download)
from wstunnel.filters import DumpFilter, FilterException
from wstunnel.test import EchoServer, EchoClient, RaiseFromWSFilter, RaiseToWSFilter
from wstunnel.client import WSTunnelClient, WebSocketProxy
from wstunnel.server import WSTunnelServer
from wstunnel.toolbox import hex_dump, random_free_port
        clt_tun = WSTunnelClient(family=socket.AF_INET,
                                 io_loop=self.io_loop)
        clt_tun.add_proxy("test", WebSocketProxy(port=0, ws_url="ws://localhost:{0}/test".format(random_free_port())))
        clt_tun.start()
        message = "Hello World!"
        srv_tun.start()
        clt_tun = WSTunnelClient(io_loop=self.io_loop)
        clt_tun.add_proxy("test", WebSocketProxy(port=0,
                                                 ws_url="ws://localhost:{0}/test".format(srv_tun.port)))
 
        clt_tun = WSTunnelClient(family=socket.AF_INET,
                                 io_loop=self.io_loop)
        clt_tun.add_proxy("test", WebSocketProxy(port=0, ws_url="ws://localhost:{0}/test".format(random_free_port())))
        clt_tun.start()
        self.assertEqual(clt_tun.ws_options, {})
    def test_add_get_remove_proxy(self):
        """
        Tests adding/remove/get operations
        """
        ws_proxy = WebSocketProxy(port=0, ws_url="ws://localhost:9000/test_add_remove")