Skip to content

Instantly share code, notes, and snippets.

View walpolsh's full-sized avatar
🏠
Working from home

Paul Walsh walpolsh

🏠
Working from home
View GitHub Profile
import React, { useEffect } from "react";
import { io } from "socket.io-client";
import "./App.css";
const endpoint = "http://127.0.0.1:5000/";
const socket = io(endpoint, {
cors: {
origin: "https://example.com",
methods: ["GET", "POST"],
allowedHeaders: ["my-custom-header"],
credentials: true,
from flask import Flask, request, jsonify
from flask_socketio import SocketIO, emit
from flask_cors import CORS
app = Flask(__name__)
socketio = SocketIO(app, logger=True, engineio_logger=True, cors_allowed_origins='http://localhost:3001')
CORS(app)
@socketio.on('connect')