0

Good Morning, I have a little problem. About the past week I have been working with NodeJS and currently writing a bot, which accepts incomming Steam Trade Offer. For this I use some steam-packages and socket.io. I have a function to check the items (souvenir, float, value, etc) and it is working correctly. After the server checked the whole offer, it is sending a socket to all connected clients.

// node-bot.js
socket.broadcast.emit('receiveOffer',{
    value: totaldeposit,
    offerid: offer.id,
    items: offer.itemsToGive,
    userid: offer.partner.getSteamID64()
});

Usually the user is receiving this socket - this is not the problem. After receiving the socket, i want to decline it directly (for debugging)

// app.js
socket.on('receiveOffer', function(data) {
    console.log("Offer received: " + data);
    socket.emit('declineOffer', {offerid:data.offerid});
});

My console is logging Offer received: [Object object]. But my server is not receiving this emitted socket declineOffer. My function is looking like this:

socket.on('declineOffer', function(offer) {
    console.log("declineOffer emitted ");
});

But the server is not printing my string declineOffer emitted. What am i doing wrong? Is there something i should do differently?

  • 1
    can you try 'socket.broadcast.emit('declineOffer', {offerid:data.offerid});' and check that event triggered or not? – alexey Mar 12 '16 at 13:35
  • Can you add hot you initialize `socket` on the server? – bolav Mar 12 '16 at 18:04
  • I'm unable to reproduce. When I get the event on the client, I receive declineOffer on the server. Please post complete sample. – bolav Mar 12 '16 at 18:17

0 Answers0