Skip to content

Commit

Permalink
Merge pull request #86 from siliataider/eliott-dev
Browse files Browse the repository at this point in the history
test 2 redirection
  • Loading branch information
Eliott-rjd authored Jan 17, 2024
2 parents a5325d7 + 1edaf36 commit 8e05013
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ private SocketIOServer initServer(){
// [VICK] This config needs to go somwere else :
// SOCKET IO CONFIG :
Configuration config = new Configuration();
config.setHostname("0.0.0.0");
config.setHostname("citymanagerjava.onrender.com");
config.setPort(5050);

// Ajoutez le middleware CORS ici
config.setOrigin("*");

// SEE : https://github.com/mrniko/netty-socketio/issues/254
SocketConfig socketConfig = new SocketConfig();
Expand All @@ -46,12 +49,6 @@ private SocketIOServer initServer(){

SocketIOServer newServer = new SocketIOServer(config);

newServer.addConnectListener(client -> {
// Enable CORS for all origins
BroadcastOperations broadcastOperations = newServer.getBroadcastOperations();
broadcastOperations.sendEvent("setOrigin", "https://citymanagerreact.onrender.com/");
});

// LISTENER WHERE EVENT IS RECIVED
newServer.addEventListener("build", String.class, new DataListener<String>() {
@Override
Expand Down
2 changes: 1 addition & 1 deletion front/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function App() {
useEffect(() =>{
// SOCKET INIT :
// SEE : https://github.com/mrniko/netty-socketio-demo
const newSocket = io('https://citymanagerjava.onrender.com/');
const newSocket = io('wss://citymanagerreact.onrender.com');

newSocket.on(socketEvents.connect, () => {
console.log('Socket Connected !');
Expand Down

0 comments on commit 8e05013

Please sign in to comment.