Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fassko/vapor-websockets-test
https://github.com/fassko/vapor-websockets-test
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/fassko/vapor-websockets-test
- Owner: fassko
- Created: 2018-06-12T11:50:20.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-12T12:08:17.000Z (over 6 years ago)
- Last Synced: 2024-10-14T15:02:20.375Z (3 months ago)
- Language: Swift
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Vapor Websocket tests
Simple Vapor web app to test websockets with GET URL parameters.
[Vapor issue](https://github.com/vapor/vapor/issues/1722)
### Start server:
`vapor build && vapor run`
## A. Doesn't work with GET URL parameters
Connect to `ws://localhost:8080/event?parameter=b`:
```
» wsta "ws://localhost:8080/event?parameter=b" -I
WebSocket upgrade request
---
Host: localhost:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: AXltXFmGcDnD8UWHfn6A3w==
Origin: http://localhostWebSocket upgrade response
---
404 Not Found
content-length: 9
date: Tue, 12 Jun 2018 11:54:47 GMTWebSocketError: WebSocket response error
```Vapor server prints in log:
```
[ ERROR ] (Function) (Logger+LogError.swift:32)
[ DEBUG ] Conform `(String, String, String, UInt, UInt) -> ()` to `Debuggable` for better debug info. (Logger+LogError.swift:34)
```## B. Works without GET URL parameters
Connect to `ws://localhost:8080/event`:
```
wsta ws://localhost:8080/event -I
WebSocket upgrade request
---
Host: localhost:8080
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: kaaTGCWD+FL4eYObXVjC9g==
Origin: http://localhostWebSocket upgrade response
---
101 Switching Protocols
Upgrade: websocket
Sec-WebSocket-Accept: gncqwda+ZhbFnyKC0Cm6hhcJnHw=
Connection: upgradeConnected to ws://localhost:8080/event
```