improve broadcast demo
This commit is contained in:
10
TODO
10
TODO
@@ -68,7 +68,7 @@ REQ = someone asked for it
|
||||
|
||||
- REQ: Overview report gets too broad: maybe rotate agent labels in report 90<39> counterclock => css
|
||||
|
||||
- REQ: make NON-STRICT more green (yes, was asked by some project to do;)
|
||||
- REQ: make NON-STRICT more green (yes, was asked by some project to do;) => td.case_almost
|
||||
|
||||
- REQ: add notice at top of report overview, explaining diff. beetween PASS, NON-STRICT and FAIL
|
||||
|
||||
@@ -111,6 +111,8 @@ Misc Cases
|
||||
|
||||
- server must fail for unmasked client frames
|
||||
|
||||
- sending a 2^63 frame.
|
||||
|
||||
|
||||
Closing Handshake Cases
|
||||
-----------------------
|
||||
@@ -146,6 +148,10 @@ Closing Handshake Cases
|
||||
|
||||
- when the fuzzer == server, test client timeout on drop TCP after close
|
||||
|
||||
- sending close codes 1005 and 1006 : isn't allowed.
|
||||
|
||||
- sending close codes <1000 >=5000 / 1004 is "reserved"
|
||||
|
||||
|
||||
Probably, we need to have a way to instruct the tested peer to iniate a
|
||||
closing handshake to test certain things (like timeouts).
|
||||
@@ -184,6 +190,8 @@ Core
|
||||
|
||||
WebSocket Protocol
|
||||
|
||||
- changes for Hybi-16 .. see also: http://code.google.com/p/pywebsocket/wiki/WebSocketProtocolSpec
|
||||
|
||||
- allow FIN = true on beginMessageFrame instead of endMessage
|
||||
|
||||
- Further optimize masking: http://stackoverflow.com/questions/2119761/simple-python-challenge-fastest-bitwise-xor-on-data-buffers
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<h1>Autobahn WebSockets Broadcast Demo</h1>
|
||||
<button onclick='webSocket.send("Hello, world!");'>Send Message</button>
|
||||
<button onclick='webSocket.send("Hello from JavaScript!");'>Send Message</button>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
42
demo/broadcast/broadcast_client.py
Normal file
42
demo/broadcast/broadcast_client.py
Normal file
@@ -0,0 +1,42 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright 2011 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
import random
|
||||
from twisted.internet import reactor
|
||||
from autobahn.websocket import WebSocketClientFactory, WebSocketClientProtocol
|
||||
|
||||
|
||||
class BroadcastClientProtocol(WebSocketClientProtocol):
|
||||
|
||||
def sendHello(self):
|
||||
self.sendMessage("Hello from Python!")
|
||||
reactor.callLater(random.random()*5, self.sendHello)
|
||||
|
||||
def onOpen(self):
|
||||
self.sendHello()
|
||||
|
||||
def onMessage(self, msg, binary):
|
||||
print "Got message: " + msg
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
factory = WebSocketClientFactory()
|
||||
factory.protocol = BroadcastClientProtocol
|
||||
reactor.connectTCP("localhost", 9000, factory)
|
||||
reactor.run()
|
||||
Reference in New Issue
Block a user