Skip to content

Commit

Permalink
Use the proper WebSocket endpoint
Browse files Browse the repository at this point in the history
Per step 2 of https://w3c.github.io/webdriver-bidi/#transport, the endpoint is supposed to be `/session` and nothing else.

Issue: #110
  • Loading branch information
mathiasbynens committed Apr 27, 2022
1 parent 4e2d5b4 commit 77eb67a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/cross-browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

async def get_websocket():
port = os.getenv('PORT', 8080)
url = f'ws://localhost:{port}'
url = f'ws://localhost:{port}/session'
return await websockets.connect(url)


Expand Down
5 changes: 3 additions & 2 deletions src/bidiServerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ export class BidiServerRunner {

if (!request.url) return response.end(404);

// Needed for WPT compatibility.
// TODO: This should be a strict match for `/session` per
// https://w3c.github.io/webdriver-bidi/#transport, step 2.
if (request.url.startsWith('/session')) {
response.writeHead(200, {
'Content-Type': 'application/json; charset=utf-8',
'Content-Type': 'application/json;charset=utf-8',
'Cache-Control': 'no-cache',
});
response.write(
Expand Down

0 comments on commit 77eb67a

Please sign in to comment.