Skip to content

Commit

Permalink
done env
Browse files Browse the repository at this point in the history
  • Loading branch information
urstrulynishkarsh committed Mar 7, 2024
1 parent dbf5b67 commit 43db5a5
Show file tree
Hide file tree
Showing 7 changed files with 5,629 additions and 470 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/thepranaygupta/react-tailwind-css-starter-pack.git"
"url": "git+https://github.com/urstrulynishkarsh/react-tailwind-css-starter-pack.git"
},
"author": "Pranay Gupta",
"author": "Nishkarsh Verma",
"bugs": {
"url": "https://github.com/thepranaygupta/react-tailwind-css-starter-pack/issues"
"url": "https://github.com/urstrulynishkarsh/react-tailwind-css-starter-pack/issues"
},
"scripts": {
"start": "react-scripts start",
Expand Down
1 change: 0 additions & 1 deletion server/.env

This file was deleted.

3 changes: 2 additions & 1 deletion server/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# .gitignore
node_modules/
node_modules/
config/
11 changes: 8 additions & 3 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path=require('path');
const http=require('http');
const socketio=require('socket.io');
const cors = require('cors');
require("dotenv").config()

const app=express()
const server=http.createServer(app);
const io=socketio(server);
Expand Down Expand Up @@ -45,8 +45,6 @@ io.on('connection',(socket)=>{
callback()
})



socket.on('sendMessage', (message, callback) => {
const user = getUser(socket.id);

Expand All @@ -60,6 +58,13 @@ io.on('connection',(socket)=>{
});


socket.on('typing', () => {
const user = getUser(socket.id);
if (user) { // Check if user exists
socket.broadcast.to(user.room).emit('userTyping', `${user.username} is typing...`);
}
});

socket.on('sendLocation', (coords, callback) => {
const user = getUser(socket.id)
io.to(user.room).emit('locationMessage', generateLocationMessage(user.username, `https://google.com/maps?q=${coords.latitude},${coords.longitude}`))
Expand Down
Loading

0 comments on commit 43db5a5

Please sign in to comment.