File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < title > Liveblocks Auth</ title >
7+ < script type ="module " src ="/room.js "> </ script >
8+ </ head >
9+ < body >
10+ < div >
11+ < p id ="status "> Not connected</ p >
12+ < button id ="connect "> Connect to Room</ button >
13+ </ div >
14+
15+ < script >
16+ document . getElementById ( 'connect' ) . addEventListener ( 'click' , ( ) => {
17+ const { room, leave } = window . client . enterRoom ( "my-room" ) ;
18+
19+ room . subscribe ( "others" , ( others ) => {
20+ document . getElementById ( 'status' ) . innerText = `There are ${ others . length } other user(s) online` ;
21+ } ) ;
22+ } ) ;
23+ </ script >
24+ </ body >
25+ </ html >
Original file line number Diff line number Diff line change 1+ {
2+ "name" : " liveblocks-javascript-authentication" ,
3+ "version" : " 1.0.0" ,
4+ "description" : " " ,
5+ "main" : " room.js" ,
6+ "scripts" : {
7+ "test" : " echo \" Error: no test specified\" && exit 1"
8+ },
9+ "author" : " " ,
10+ "license" : " ISC"
11+ }
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { createClient } from "@liveblocks/client";
22
33const client = createClient ( {
44 publicApiKey : "pk_dev_4hBTxoM5Vkir7gRMcIEP99BTDpqay7jjxcG9ELGa4fomzhWfbzkWgOh4qbU4Rhup" ,
5- authEndpoint : "/auth.php" ,
5+ authEndpoint : "http://localhost /auth.php" ,
66} ) ;
77
88export const { room, leave } = client . enterRoom ( "my-room" ) ;
You can’t perform that action at this time.
0 commit comments