sudheeshshetty / chat Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
socket.on('private message',function(msg){
console.log('message :'+msg.split("#*@")[0]);
models.messages.create({
"message":msg.split("#*@")[1],
"sender" :msg.split("#*@")[2],
"reciever":msg.split("#*@")[0],
"date" : new Date()});
io.to(users[msg.split("#*@")[0]]).emit('private message', msg);
});
The above msg
is coming from frontend and thus anyone can impersonate anyone by changing the string they are sending from the frontend
Hi, i installed all modules and run "npm start" but it throws Error: [nodemon] 1.17.3
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node server.js
Could not connect to mongo server!
{ Error: Trying to open unclosed connection.
at NativeConnection.Connection._handleOpenArgs (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongoose\lib\connection.js:214:11)
at NativeConnection. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongoose\lib\connection.js:309:37)
at NativeConnection.deprecated [as open] (internal/util.js:52:15)
at Mongoose.connect (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongoose\lib\index.js:268:47)
at Object. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\model\model.js:15:10)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\controller\controller.js:1:76)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32) state: 2 }
(node:21828) DeprecationWarning: open()
is deprecated in mongoose >= 4.11.0, use openUri()
instead, or set the useMongoClient
option if using connect()
or createConnection()
. See http://mongoosejs.com/docs/4.x/docs/connections.html#use-mongo-client
Node Server is setup and it is listening on http://192.168.1.22:8080
Could not connect to mongo server!
{ MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]
at Pool. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongodb-core\lib\topologies\server.js:336:35)
at emitOne (events.js:116:13)
at Pool.emit (events.js:211:7)
at Connection. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongodb-core\lib\connection\pool.js:280:12)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at Socket. (C:\Users\User\Documents\Node-Projects\chat-example\Chat\node_modules\mongodb-core\lib\connection\connection.js:189:49)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoError',
message: 'failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFUSED 127.0.0.1:27017]' }
I get this error when trying to start the server.
MongooseError: Can't call openUri()
on an active connection with different connection strings. Make sure you aren't calling mongoose.connect()
multiple times. See: https://mongoosejs.com/docs/connections.html#multiple_connections
at NativeConnection.Connection.openUri (C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\connection.js:693:13)
at C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\index.js:345:10
at C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\helpers\promiseOrCallback.js:31:5
at new Promise ()
at promiseOrCallback (C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\helpers\promiseOrCallback.js:30:10)
at Mongoose._promiseOrCallback (C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\index.js:1135:10)
at Mongoose.connect (C:\Users\Master\Desktop\Chat-master\node_modules\mongoose\lib\index.js:344:20)
at Object. (C:\Users\Master\Desktop\Chat-master\model\model.js:15:10)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object. (C:\Users\Master\Desktop\Chat-master\controller\controller.js:1:14)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
[nodemon] app crashed - waiting for file changes before starting...
Can I publish it on playstore because that is a webapp
plss reply....thank you in advance๐๐
I want to implement this chat my mobile app project. Is it possible to implement in apk?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.