Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wspy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
wspy
Commits
390212ed
Commit
390212ed
authored
Nov 06, 2012
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code cleanup
parent
7cf4ddca
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
13 deletions
+19
-13
server.py
server.py
+13
-7
websocket.py
websocket.py
+6
-6
No files found.
server.py
View file @
390212ed
...
@@ -47,12 +47,6 @@ class Server(object):
...
@@ -47,12 +47,6 @@ class Server(object):
"""
"""
pass
pass
def
onclose
(
self
,
client
):
"""
Called when a client disconnects.
"""
pass
def
onmessage
(
self
,
client
,
message
):
def
onmessage
(
self
,
client
,
message
):
"""
"""
Called when a message is received from some client. `message' is a
Called when a message is received from some client. `message' is a
...
@@ -60,15 +54,27 @@ class Server(object):
...
@@ -60,15 +54,27 @@ class Server(object):
"""
"""
raise
NotImplemented
raise
NotImplemented
def
onclose
(
self
,
client
):
"""
Called when a client disconnects.
"""
pass
class
Client
(
WebSocket
):
class
Client
(
WebSocket
):
def
__init__
(
self
,
server
,
sock
,
address
):
def
__init__
(
self
,
server
,
sock
,
address
):
super
(
Client
,
self
).
__init__
(
sock
,
address
)
super
(
Client
,
self
).
__init__
(
sock
,
address
)
self
.
server
=
server
self
.
server
=
server
def
handle_message
(
self
,
message
):
def
onopen
(
self
):
self
.
server
.
onopen
(
self
)
def
onmessage
(
self
,
message
):
self
.
server
.
onmessage
(
self
,
message
)
self
.
server
.
onmessage
(
self
,
message
)
def
onclose
(
self
):
self
.
server
.
onclose
(
self
,
message
)
def
__str__
(
self
):
def
__str__
(
self
):
return
'<Client at %s:%d>'
%
self
.
address
return
'<Client at %s:%d>'
%
self
.
address
...
...
websocket.py
View file @
390212ed
...
@@ -93,12 +93,6 @@ class WebSocket(FrameReceiver):
...
@@ -93,12 +93,6 @@ class WebSocket(FrameReceiver):
"""
"""
pass
pass
def
onclose
(
self
):
"""
Called when the other end of the socket disconnects.
"""
pass
def
onmessage
(
self
,
message
):
def
onmessage
(
self
,
message
):
"""
"""
Called when a message is received. `message' is a Message object, which
Called when a message is received. `message' is a Message object, which
...
@@ -106,5 +100,11 @@ class WebSocket(FrameReceiver):
...
@@ -106,5 +100,11 @@ class WebSocket(FrameReceiver):
"""
"""
raise
NotImplemented
raise
NotImplemented
def
onclose
(
self
):
"""
Called when the other end of the socket disconnects.
"""
pass
def
close
(
self
):
def
close
(
self
):
raise
SocketClosed
()
raise
SocketClosed
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment