Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for change in websocket-client API, update docs, make port of client and server match #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ For server (Node.js) - install it with npm

For client (Java App) - go to the client folder and type 'mvn install'. make sure you install maven before proceed.

For client (Python 2.7 App) - install dependencies with `pip install -r requirements.txt` in this directory, then execute `python client.py` in this directory.
15 changes: 8 additions & 7 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""
client.py

Python 2.7.x

Based heavily on:
- https://github.com/mtah/python-websocket/blob/master/examples/echo.py
- http://stackoverflow.com/a/7586302/316044
Expand Down Expand Up @@ -41,18 +43,17 @@ def __init__(self, server, port):
resp = conn.getresponse()
hskey = resp.read().split(':')[0]

self.ws = websocket.WebSocket(
self.ws = websocket.WebSocketApp(
'ws://'+server+':'+str(port)+'/socket.io/1/websocket/'+hskey,
onopen = self._onopen,
onmessage = self._onmessage,
onclose = self._onclose,
onerror = self._onerror)
on_open = self._onopen,
on_message = self._onmessage,
on_close = self._onclose,
on_error = self._onerror)
self.state = Client.DISCONNECTED


def _onopen(self):
self.state = Client.CONNECTED

Client.addMessage("open")

self.heartbeat()
Expand Down Expand Up @@ -150,7 +151,7 @@ def processChat():
if __name__ == '__main__':

parser = argparse.ArgumentParser(description="Load tester for socket.io applications (customized for ROAR)")
parser.add_argument('-p', '--port', action='store', default=8888)
parser.add_argument('-p', '--port', action='store', default=8080)
parser.add_argument('-c', '--concurrency', type=int, default=1)
parser.add_argument('-C', '--chat',metavar="MSGS_PER_MIN_CLIENT", default=0)
parser.add_argument('server')
Expand Down
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
six==1.10.0
websocket-client==0.35.0
wheel==0.26.0