Open SumukhaK opened 3 years ago
console.log('new channel created')
is only called from a database callback passed to newChannel.save
.
You may want to check if your socket callback get invoked. Just add console.log('received newChannel message)
just before
//Create channel
let newChannel = new Channel({
If you don't see "received newChannel message" in Heroku logs, then the problem is with your client. If you do see this message, but not "new channel created", the problem is on the server, and you need to find out why the callback on database save is not invoked.
Thanks for the reply. I think I wasn't clear in my edit-2. I resolved the issue by myself. I don't know what the exact problem was, but once I changed the socket library I used in my kotlin code it worked but I received jibberish texts on channel name and description, but that was because I didn't pass the proper parameters while calling socket.emit from kotlin. So once I fixed my socket.emit, it worked just fine.
When I do this on my Kotlin Activity :
socket.emit("newChannel",channelName,channelDesc)
I don't see any channel getting created on mongo as shown in the tutorial. Nor any log on Heroku such as : new channel created . However I do get : a user connected at=info method=GET path="/socket.io/?EIO=4&transport=polling" host=herokumongodbsmackchat.herokuapp.com request_id=61a72504-c0ae-439f-9f75-228d3aae7a6b fwd="100.100.000.000" dyno=web.1 connect=1ms service=5ms status=200 bytes=328 protocol=https
Here's my index.js api code :
Edit-2 : I used a different library for Socket communication and I didn't send the proper parameters.
used : 'com.github.nkzawa:socket.io-client:0.6.0' . Rest of the steps are same as the one in the JohnnyB's tutorial