File tree Expand file tree Collapse file tree 5 files changed +8
-12
lines changed Expand file tree Collapse file tree 5 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ const startServer = async () => {
1111
1212 const io = new Server ( server , {
1313 cors : {
14- origin : 'http://localhost:3000 ' ,
14+ origin : '* ' ,
1515 methods : [ 'GET' ] ,
16+ transports : [ 'websocket' ] ,
1617 } ,
1718 } ) ;
1819
Original file line number Diff line number Diff line change 11import React , { createContext } from 'react' ;
22import io from 'socket.io-client' ;
33
4- export const socket = io ( 'http://localhost:4040' ) ;
4+ export const socket = io ( 'http://localhost:4040' , {
5+ transports : [ 'websocket' ] ,
6+ } ) ;
57
68export const SocketContext = createContext ( ) ;
Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22< html >
33 < head >
4- < link rel ="stylesheet " href ="index.css " />
54 < script src ="./index.js "> </ script >
65 < style >
76 .container {
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ entrypoints.setup({
1313 } ,
1414} ) ;
1515
16- let socket = io ( 'http://localhost:4040' ) ;
16+ let socket = io ( 'http://localhost:4040' , {
17+ transports : [ 'websocket' ] ,
18+ } ) ;
1719
1820// Attempt to reconnect if server isn't running
1921socket . on ( 'connect_error' , ( ) => {
You can’t perform that action at this time.
0 commit comments