Skip to content

Instantly share code, notes, and snippets.

View KaidiMohammed's full-sized avatar
🎯
Focusing

KaidiMohammed

🎯
Focusing
View GitHub Profile
const express = require("express");
const http = require("http");
const socketIo = require("socket.io");
const port = process.env.PORT || 4001;
const index = require("./routes/index");
const moment = require("moment");
const app = express();
app.use(index);
const server = http.createServer(app);
const io = socketIo(server);
return (
<div>
<h3 className="d-flex justify-content-center"> Connected users : {user.usersList?.length} </h3>
<table className="table">
<thead>
<tr>
<th> User name </th>
<th> Connection Date </th>
</tr>
</thead>
function App() {
const [user, setUser] = useState({
usersList: null
});
const [msg, setMsg] = useState("");
const [recMsg, setRecMsg] = useState({
listMsg: []
});
const [loggedUser, setLoggedUser] = useState();
function App() {
const [user, setUser] = useState({
usersList: null
});
const [msg, setMsg] = useState("");
const [recMsg, setRecMsg] = useState({
listMsg: []
});
const [loggedUser, setLoggedUser] = useState();
import React, { useState, useEffect } from "react";
import socketIOClient from "socket.io-client";
import userGen from "username-generator"
import { Button, Input } from 'reactstrap';
const ENDPOINT = "http://127.0.0.1:4001";
const socket = socketIOClient(ENDPOINT);