-
Notifications
You must be signed in to change notification settings - Fork 284
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1836 from rejectedsoftware/1534_websockets
Improve web sockets and add autobahn test suite client merged-on-behalf-of: Sönke Ludwig <[email protected]>
- Loading branch information
Showing
5 changed files
with
177 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
tests/not-runnable/vibe.http.websocket-autobahn-client/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
websockets-autobahn-client | ||
.dub | ||
docs.json | ||
__dummy.html | ||
*.o | ||
*.obj |
9 changes: 9 additions & 0 deletions
9
tests/not-runnable/vibe.http.websocket-autobahn-client/dub.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "websockets-autobahn-client", | ||
"dependencies": { | ||
"vibe-d": { "path": "../../" } | ||
}, | ||
"versions": [ | ||
"VibeDefaultMain" | ||
] | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/not-runnable/vibe.http.websocket-autobahn-client/source/app.d
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import vibe.d; | ||
|
||
shared static this () | ||
{ | ||
runTask(() => runTestSuite()); | ||
} | ||
|
||
void runTestSuite () | ||
{ | ||
auto count = getCaseCount(); | ||
logInfo("We're going to run %d test cases...", count); | ||
|
||
foreach (currCase; 1 .. count) | ||
{ | ||
auto url = URL("ws://127.0.0.1:9001/runCase?agent=vibe.d&case=" | ||
~ to!string(currCase)); | ||
logInfo("Running test case %d/%d", currCase, count); | ||
connectWebSocket( | ||
url, (scope ws) { | ||
while (ws.waitForData) { | ||
ws.receive((scope message) { | ||
ws.send(message.readAll); | ||
}); | ||
} | ||
}); | ||
} | ||
} | ||
|
||
|
||
size_t getCaseCount (string base_addr = "ws://127.0.0.1:9001") | ||
{ | ||
size_t ret; | ||
auto url = URL(base_addr ~ "/getCaseCount"); | ||
connectWebSocket( | ||
url, (scope ws) { | ||
while (ws.waitForData) { | ||
ret = ws.receiveText.to!size_t; | ||
} | ||
}); | ||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters