replace localhost with 127.0.0.1 in all examples
This ensures we use IPv4 addresses; at least with Trollius on Python 2.7 "localhost" can result in IPv6 addresses but the examples are all currently written for IPv4
This commit is contained in:
parent
3fce8aca71
commit
8db76f8b2a
@ -21,7 +21,7 @@ class MyComponent(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -18,7 +18,7 @@ class MyComponent(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -51,7 +51,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -59,7 +59,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -60,7 +60,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -64,7 +64,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -55,7 +55,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -74,7 +74,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -61,7 +61,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -61,7 +61,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -60,7 +60,7 @@ if __name__ == '__main__':
|
|||||||
options = ssl.create_default_context(cadata=open(cert_path, 'r').read())
|
options = ssl.create_default_context(cadata=open(cert_path, 'r').read())
|
||||||
# ...which we pass as "ssl=" to ApplicationRunner (passed to loop.create_connection)
|
# ...which we pass as "ssl=" to ApplicationRunner (passed to loop.create_connection)
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "wss://localhost:8083/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "wss://127.0.0.1:8083/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
ssl=options, # try removing this, but still use self-signed cert
|
ssl=options, # try removing this, but still use self-signed cert
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
|
@ -76,7 +76,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -69,7 +69,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -86,7 +86,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -75,7 +75,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -61,7 +61,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -94,7 +94,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -91,7 +91,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -62,7 +62,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -60,7 +60,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -69,7 +69,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -53,7 +53,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -62,7 +62,7 @@ if __name__ == '__main__':
|
|||||||
# Trollius >= 0.3 was renamed
|
# Trollius >= 0.3 was renamed
|
||||||
import trollius as asyncio
|
import trollius as asyncio
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyClientProtocol
|
factory.protocol = MyClientProtocol
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -60,7 +60,7 @@ class MyClientProtocol(WebSocketClientProtocol):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyClientProtocol
|
factory.protocol = MyClientProtocol
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -57,7 +57,7 @@ class MyClientProtocol(WebSocketClientProtocol):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyClientProtocol
|
factory.protocol = MyClientProtocol
|
||||||
|
|
||||||
loop = trollius.get_event_loop()
|
loop = trollius.get_event_loop()
|
||||||
|
@ -57,7 +57,7 @@ if __name__ == '__main__':
|
|||||||
# Trollius >= 0.3 was renamed
|
# Trollius >= 0.3 was renamed
|
||||||
import trollius as asyncio
|
import trollius as asyncio
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyServerProtocol
|
factory.protocol = MyServerProtocol
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -58,7 +58,7 @@ if __name__ == '__main__':
|
|||||||
# Trollius >= 0.3 was renamed
|
# Trollius >= 0.3 was renamed
|
||||||
import trollius as asyncio
|
import trollius as asyncio
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = SlowSquareClientProtocol
|
factory.protocol = SlowSquareClientProtocol
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -58,7 +58,7 @@ class SlowSquareServerProtocol(WebSocketServerProtocol):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = SlowSquareServerProtocol
|
factory.protocol = SlowSquareServerProtocol
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
@ -55,7 +55,7 @@ class SlowSquareServerProtocol(WebSocketServerProtocol):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = SlowSquareServerProtocol
|
factory.protocol = SlowSquareServerProtocol
|
||||||
|
|
||||||
loop = trollius.get_event_loop()
|
loop = trollius.get_event_loop()
|
||||||
|
@ -91,7 +91,7 @@ if __name__ == '__main__':
|
|||||||
# Trollius >= 0.3 was renamed
|
# Trollius >= 0.3 was renamed
|
||||||
import trollius as asyncio
|
import trollius as asyncio
|
||||||
|
|
||||||
factory = TesteeServerFactory("ws://localhost:9002", debug=False)
|
factory = TesteeServerFactory("ws://127.0.0.1:9002", debug=False)
|
||||||
|
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
coro = loop.create_server(factory, port=9002)
|
coro = loop.create_server(factory, port=9002)
|
||||||
|
@ -102,7 +102,7 @@ if __name__ == '__main__':
|
|||||||
from autobahn.twisted.wamp import ApplicationRunner
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
|
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -94,7 +94,7 @@ if __name__ == '__main__':
|
|||||||
#
|
#
|
||||||
@run_in_reactor
|
@run_in_reactor
|
||||||
def start_wamp():
|
def start_wamp():
|
||||||
wapp.run("ws://localhost:9000", "realm1", standalone=True, start_reactor=False)
|
wapp.run("ws://127.0.0.1:9000", "realm1", standalone=True, start_reactor=False)
|
||||||
|
|
||||||
start_wamp()
|
start_wamp()
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ if __name__ == '__main__':
|
|||||||
# run WAMP application component
|
# run WAMP application component
|
||||||
##
|
##
|
||||||
from autobahn.twisted.wamp import ApplicationRunner
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
router = args.router or 'ws://localhost:9000'
|
router = args.router or 'ws://127.0.0.1:9000'
|
||||||
|
|
||||||
runner = ApplicationRunner(router, u"realm1", standalone=not args.router,
|
runner = ApplicationRunner(router, u"realm1", standalone=not args.router,
|
||||||
debug=False, # low-level logging
|
debug=False, # low-level logging
|
||||||
|
@ -50,4 +50,4 @@ def onjoined():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run("ws://localhost:8080/ws", "realm1", standalone=True)
|
app.run("ws://127.0.0.1:8080/ws", "realm1", standalone=True)
|
||||||
|
@ -111,7 +111,7 @@ if __name__ == '__main__':
|
|||||||
# run WAMP application component
|
# run WAMP application component
|
||||||
##
|
##
|
||||||
from autobahn.twisted.wamp import ApplicationRunner
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
router = args.router or 'ws://localhost:9000'
|
router = args.router or 'ws://127.0.0.1:9000'
|
||||||
|
|
||||||
runner = ApplicationRunner(router, u"realm1", standalone=not args.router,
|
runner = ApplicationRunner(router, u"realm1", standalone=not args.router,
|
||||||
debug=False, # low-level logging
|
debug=False, # low-level logging
|
||||||
|
@ -36,4 +36,4 @@ def square(x):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run("ws://localhost:9000", "realm1", standalone=True)
|
app.run("ws://127.0.0.1:9000", "realm1", standalone=True)
|
||||||
|
@ -48,4 +48,4 @@ if __name__ == "__main__":
|
|||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
reactor.listenTCP(8080, Site(app.resource()))
|
reactor.listenTCP(8080, Site(app.resource()))
|
||||||
wampapp.run("ws://localhost:9000", "realm1", standalone=False)
|
wampapp.run("ws://127.0.0.1:9000", "realm1", standalone=False)
|
||||||
|
@ -80,4 +80,4 @@ if __name__ == "__main__":
|
|||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
reactor.listenTCP(8080, Site(webapp.resource()))
|
reactor.listenTCP(8080, Site(webapp.resource()))
|
||||||
wampapp.run("ws://localhost:9000", "realm1", standalone=True)
|
wampapp.run("ws://127.0.0.1:9000", "realm1", standalone=True)
|
||||||
|
@ -161,7 +161,7 @@ if __name__ == '__main__':
|
|||||||
# run WAMP application component
|
# run WAMP application component
|
||||||
##
|
##
|
||||||
from autobahn.twisted.wamp import ApplicationRunner
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
router = args.router or 'ws://localhost:8080'
|
router = args.router or 'ws://127.0.0.1:8080'
|
||||||
|
|
||||||
runner = ApplicationRunner(router, u"realm1",
|
runner = ApplicationRunner(router, u"realm1",
|
||||||
extra={'port': args.port, 'baudrate': args.baudrate, 'debug': args.debug},
|
extra={'port': args.port, 'baudrate': args.baudrate, 'debug': args.debug},
|
||||||
|
@ -46,4 +46,4 @@ def onjoined():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run("ws://localhost:8080/ws", "realm1", standalone=True)
|
app.run("ws://127.0.0.1:8080/ws", "realm1", standalone=True)
|
||||||
|
@ -23,7 +23,7 @@ class MyComponent(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -19,7 +19,7 @@ class MyComponent(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -51,7 +51,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -62,7 +62,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
extra=dict(
|
extra=dict(
|
||||||
max_events=5, # [A] pass in additional configuration
|
max_events=5, # [A] pass in additional configuration
|
||||||
|
@ -61,7 +61,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -68,7 +68,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -56,7 +56,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -70,7 +70,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -67,7 +67,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -64,7 +64,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -52,7 +52,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -72,7 +72,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -65,7 +65,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -85,7 +85,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -56,7 +56,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -88,7 +88,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -61,7 +61,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -93,7 +93,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -91,7 +91,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -62,7 +62,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -59,7 +59,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -60,7 +60,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -57,7 +57,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -58,7 +58,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -66,7 +66,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -55,7 +55,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -55,7 +55,7 @@ class Component(ApplicationSession):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://localhost:8080/ws"),
|
environ.get("AUTOBAHN_DEMO_ROUTER", "ws://127.0.0.1:8080/ws"),
|
||||||
u"crossbardemo",
|
u"crossbardemo",
|
||||||
debug_wamp=False, # optional; log many WAMP details
|
debug_wamp=False, # optional; log many WAMP details
|
||||||
debug=False, # optional; log even more details
|
debug=False, # optional; log even more details
|
||||||
|
@ -121,7 +121,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
# test drive the component during development ..
|
# test drive the component during development ..
|
||||||
runner = ApplicationRunner(
|
runner = ApplicationRunner(
|
||||||
url="ws://localhost:8080/ws",
|
url="ws://127.0.0.1:8080/ws",
|
||||||
realm="realm1",
|
realm="realm1",
|
||||||
extra=extra,
|
extra=extra,
|
||||||
debug=False, # low-level WebSocket debugging
|
debug=False, # low-level WebSocket debugging
|
||||||
|
@ -230,7 +230,7 @@ if __name__ == '__main__':
|
|||||||
print("Running Autobahn|Python {}".format(autobahn.version))
|
print("Running Autobahn|Python {}".format(autobahn.version))
|
||||||
|
|
||||||
# our WebSocket server factory
|
# our WebSocket server factory
|
||||||
factory = PersonaServerFactory("ws://localhost:8080")
|
factory = PersonaServerFactory("ws://127.0.0.1:8080")
|
||||||
|
|
||||||
# we serve static files under "/" ..
|
# we serve static files under "/" ..
|
||||||
root = File(".")
|
root = File(".")
|
||||||
|
@ -53,7 +53,7 @@ class BroadcastClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
factory = WebSocketClientFactory(sys.argv[1])
|
factory = WebSocketClientFactory(sys.argv[1])
|
||||||
|
@ -112,7 +112,7 @@ if __name__ == '__main__':
|
|||||||
ServerFactory = BroadcastServerFactory
|
ServerFactory = BroadcastServerFactory
|
||||||
# ServerFactory = BroadcastPreparedServerFactory
|
# ServerFactory = BroadcastPreparedServerFactory
|
||||||
|
|
||||||
factory = ServerFactory("ws://localhost:9000",
|
factory = ServerFactory("ws://127.0.0.1:9000",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyClientProtocol
|
factory.protocol = MyClientProtocol
|
||||||
|
|
||||||
reactor.connectTCP("127.0.0.1", 9000, factory)
|
reactor.connectTCP("127.0.0.1", 9000, factory)
|
||||||
|
@ -70,7 +70,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
factory = WebSocketClientFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketClientFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyClientProtocol
|
factory.protocol = MyClientProtocol
|
||||||
|
|
||||||
reactor.connectTCP("127.0.0.1", 9000, factory)
|
reactor.connectTCP("127.0.0.1", 9000, factory)
|
||||||
|
@ -58,7 +58,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000", debug=False)
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000", debug=False)
|
||||||
factory.protocol = MyServerProtocol
|
factory.protocol = MyServerProtocol
|
||||||
# factory.setProtocolOptions(maxConnections=2)
|
# factory.setProtocolOptions(maxConnections=2)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ class EchoClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
||||||
|
@ -56,7 +56,7 @@ class EchoClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "Need the WebSocket server address, i.e. ws://localhost:9000"
|
print "Need the WebSocket server address, i.e. ws://127.0.0.1:9000"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
||||||
|
@ -59,7 +59,7 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000",
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000",
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -72,11 +72,11 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument("-d", "--debug", action="store_true",
|
parser.add_argument("-d", "--debug", action="store_true",
|
||||||
help="Enable debug output.")
|
help="Enable debug output.")
|
||||||
|
|
||||||
parser.add_argument("--websocket", default="tcp:localhost:9000",
|
parser.add_argument("--websocket", default="tcp:127.0.0.1:9000",
|
||||||
help='WebSocket client Twisted endpoint descriptor, e.g. "tcp:localhost:9000" or "unix:/tmp/mywebsocket".')
|
help='WebSocket client Twisted endpoint descriptor, e.g. "tcp:127.0.0.1:9000" or "unix:/tmp/mywebsocket".')
|
||||||
|
|
||||||
parser.add_argument("--wsurl", default="ws://localhost:9000",
|
parser.add_argument("--wsurl", default="ws://127.0.0.1:9000",
|
||||||
help='WebSocket URL (must suit the endpoint), e.g. "ws://localhost:9000".')
|
help='WebSocket URL (must suit the endpoint), e.g. "ws://127.0.0.1:9000".')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument("--websocket", default="tcp:9000",
|
parser.add_argument("--websocket", default="tcp:9000",
|
||||||
help='WebSocket server Twisted endpoint descriptor, e.g. "tcp:9000" or "unix:/tmp/mywebsocket".')
|
help='WebSocket server Twisted endpoint descriptor, e.g. "tcp:9000" or "unix:/tmp/mywebsocket".')
|
||||||
|
|
||||||
parser.add_argument("--wsurl", default="ws://localhost:9000",
|
parser.add_argument("--wsurl", default="ws://127.0.0.1:9000",
|
||||||
help='WebSocket URL (must suit the endpoint), e.g. "ws://localhost:9000".')
|
help='WebSocket URL (must suit the endpoint), e.g. "ws://127.0.0.1:9000".')
|
||||||
|
|
||||||
parser.add_argument("--web", default="tcp:8080",
|
parser.add_argument("--web", default="tcp:8080",
|
||||||
help='Web server endpoint descriptor, e.g. "tcp:8080".')
|
help='Web server endpoint descriptor, e.g. "tcp:8080".')
|
||||||
|
@ -54,7 +54,7 @@ class EchoClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
||||||
|
@ -65,7 +65,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
headers = {'MyCustomServerHeader': 'Foobar'}
|
headers = {'MyCustomServerHeader': 'Foobar'}
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000",
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
@ -355,7 +355,7 @@ if __name__ == '__main__':
|
|||||||
DEFAULT_WORKERS = psutil.NUM_CPUS
|
DEFAULT_WORKERS = psutil.NUM_CPUS
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Autobahn WebSocket Echo Multicore Server')
|
parser = argparse.ArgumentParser(description='Autobahn WebSocket Echo Multicore Server')
|
||||||
parser.add_argument('--wsuri', dest='wsuri', type=str, default='ws://localhost:9000', help='The WebSocket URI the server is listening on, e.g. ws://localhost:9000.')
|
parser.add_argument('--wsuri', dest='wsuri', type=str, default='ws://127.0.0.1:9000', help='The WebSocket URI the server is listening on, e.g. ws://localhost:9000.')
|
||||||
parser.add_argument('--port', dest='port', type=int, default=8080, help='Port to listen on for embedded Web server. Set to 0 to disable.')
|
parser.add_argument('--port', dest='port', type=int, default=8080, help='Port to listen on for embedded Web server. Set to 0 to disable.')
|
||||||
parser.add_argument('--workers', dest='workers', type=int, default=DEFAULT_WORKERS, help='Number of workers to spawn - should fit the number of (physical) CPU cores.')
|
parser.add_argument('--workers', dest='workers', type=int, default=DEFAULT_WORKERS, help='Number of workers to spawn - should fit the number of (physical) CPU cores.')
|
||||||
parser.add_argument('--noaffinity', dest='noaffinity', action="store_true", default=False, help='Do not set worker/CPU affinity.')
|
parser.add_argument('--noaffinity', dest='noaffinity', action="store_true", default=False, help='Do not set worker/CPU affinity.')
|
||||||
|
@ -60,7 +60,7 @@ class EchoService(service.Service):
|
|||||||
|
|
||||||
def startService(self):
|
def startService(self):
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:%d" % self.port, debug=self.debug)
|
factory = WebSocketServerFactory("ws://127.0.0.1:%d" % self.port, debug=self.debug)
|
||||||
|
|
||||||
factory.protocol = EchoServerProtocol
|
factory.protocol = EchoServerProtocol
|
||||||
factory.setProtocolOptions(allowHixie76=True) # needed if Hixie76 is to be supported
|
factory.setProtocolOptions(allowHixie76=True) # needed if Hixie76 is to be supported
|
||||||
|
@ -55,7 +55,7 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:8080",
|
factory = WebSocketServerFactory("ws://127.0.0.1:8080",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ if __name__ == '__main__':
|
|||||||
contextFactory = ssl.DefaultOpenSSLContextFactory('keys/server.key',
|
contextFactory = ssl.DefaultOpenSSLContextFactory('keys/server.key',
|
||||||
'keys/server.crt')
|
'keys/server.crt')
|
||||||
|
|
||||||
factory = WebSocketServerFactory("wss://localhost:8080",
|
factory = WebSocketServerFactory("wss://127.0.0.1:8080",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ if __name__ == '__main__':
|
|||||||
log.startLogging(sys.stdout)
|
log.startLogging(sys.stdout)
|
||||||
|
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-u", "--url", dest="url", help="The WebSocket URL", default="wss://localhost:9000")
|
parser.add_option("-u", "--url", dest="url", help="The WebSocket URL", default="wss://127.0.0.1:9000")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
# create a WS server factory with our protocol
|
# create a WS server factory with our protocol
|
||||||
|
@ -56,7 +56,7 @@ if __name__ == '__main__':
|
|||||||
contextFactory = ssl.DefaultOpenSSLContextFactory('keys/server.key',
|
contextFactory = ssl.DefaultOpenSSLContextFactory('keys/server.key',
|
||||||
'keys/server.crt')
|
'keys/server.crt')
|
||||||
|
|
||||||
factory = WebSocketServerFactory("wss://localhost:9000",
|
factory = WebSocketServerFactory("wss://127.0.0.1:9000",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ class EchoClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
||||||
|
@ -73,7 +73,7 @@ class EchoClientFactory(ReconnectingClientFactory, WebSocketClientFactory):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
if len(sys.argv) > 2 and sys.argv[2] == 'debug':
|
||||||
|
@ -59,7 +59,7 @@ class EchoClientFactory(WebSocketClientFactory):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print "Need the WebSocket server address, i.e. ws://localhost:9000"
|
print "Need the WebSocket server address, i.e. ws://127.0.0.1:9000"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
factory = EchoClientFactory(sys.argv[1])
|
factory = EchoClientFactory(sys.argv[1])
|
||||||
|
@ -51,7 +51,7 @@ class EchoClientProtocol(WebSocketClientProtocol):
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
print("Need the WebSocket server address, i.e. ws://localhost:9000")
|
print("Need the WebSocket server address, i.e. ws://127.0.0.1:9000")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
|
@ -50,7 +50,7 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
debug = False
|
debug = False
|
||||||
|
|
||||||
factory = WebSocketServerFactory("ws://localhost:9000",
|
factory = WebSocketServerFactory("ws://127.0.0.1:9000",
|
||||||
debug=debug,
|
debug=debug,
|
||||||
debugCodePaths=debug)
|
debugCodePaths=debug)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user