Advertisement
KoctrX

Untitled

Aug 5th, 2024
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5.     <meta charset="UTF-8">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Socket io example</title>
  8. </head>
  9.  
  10. <body>
  11.     <h1>Socket example</h1>
  12.     <input id="test" type="file">
  13.  
  14.     <script src="/socket.io/socket.io.js"></script>
  15.     <script>
  16.         const socket = io('https://bjj.webstaginghub.com', {
  17.             path: '/socket',
  18.             transports: ['websocket'],
  19.             auth: {
  20.                 //token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjEsImVtYWlsIjoiYWZwdnlibGdsQDEwbWFpbC5vcmciLCJwYXNzd29yZCI6IiQyYiQxMCRoR1FVTUUxT2dNaEM2R1Voa0t1NWtPM1llWENXTDBQeGVFZGQ2THdubnZMVGZ4UlF6eUM2dSIsImlhdCI6MTcyMDA3NzQxNywiZXhwIjoxNzIyNjY5NDE3fQ.hTzknSBDSrraSUFzhCH7wrZKg4ksNN1fLNQLtzuOUfE`,
  21.                 token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOjI5LCJlbWFpbCI6InhhdGF4ZTgzMTdAbndlYWwuY29tIiwicGFzc3dvcmQiOiIkMmIkMTAkYVdCbXZiYlludnBKbjVBTkFDcUp1ZS9MT3g2Y0NSTGRxZUN1eTkuSGYvZ1A1ekhwSC51bmEiLCJpYXQiOjE3MjI4NDM2NTIsImV4cCI6MTcyNTQzNTY1Mn0.ofzt_mfgwB68aObEAi9MBHb61wzWXsYMgReQ2_xrnPY'
  22.             }
  23.         });
  24.        
  25.         socket.on('chat:newMessage', data => {
  26.             console.log('chat:newMessage: ', data);
  27.         });
  28.        
  29.         socket.on('chat:readedMessages', data => {
  30.             console.log('chat:readedMessages: ', data);
  31.         });
  32.     </script>
  33. </body>
  34.  
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement