Skip to content

Commit

Permalink
Use the proper WebSocket endpoint (#111)
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` (with an optional query string
attached to it).

Issue: #110
  • Loading branch information
mathiasbynens authored Apr 27, 2022
1 parent 4e2d5b4 commit 4db34eb
Show file tree
Hide file tree
Showing 2 changed files with 3 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
4 changes: 2 additions & 2 deletions src/bidiServerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export class BidiServerRunner {

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

// Needed for WPT compatibility.
// 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 4db34eb

Please sign in to comment.