Skip to content

Commit

Permalink
Update http_websocket.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Torxed committed Jun 20, 2020
1 parent 264942a commit 4215405
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions examples/http_websocket.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,9 @@
import slimhttpd
import spiderWeb
import spiderWeb # Requires https://github.com/Torxed/spiderWeb

http = slimhttpd.host(slimhttpd.HTTP)
websocket = spiderWeb.WebSocket()

@http.configuration
def config(instance):
return {
'web_root' : './',
'index' : 'index.html'
}

@http.on_close
def close(client_identity):
http.unregister(client_identity)
client_identity.close()

@http.route('/hellowWorld.html')
def api_helloWorld(request):
return slimhttpd.HTTP_RESPONSE(headers={'Content-Type' : 'text/html'},
payload=b'<html><body>Test</body></html>')

@websocket.route('/auth/login')
def auth_handler(request):
print('Auth:', request)
Expand All @@ -34,5 +17,4 @@ def upgrade(request):

while 1:
for event, *event_data in http.poll():
# print(event, event_data)
pass
pass

0 comments on commit 4215405

Please sign in to comment.