//send just calls JSON.stringify and then client.write using that string //respond to a ping state.client.send({ type: 'rpc', id: 2, name: 'user.pong', args: []}); //join a room state.client.send({ type: 'rpc', id: 1, name: 'room.join', args: [room]}); //woot a song (first args parameter is true for woot, false for meh) state.client.send({type: 'rpc', id: 4, name: 'room.cast', args: [true, state.data.room.historyID, true]}); You need to have a new id for every RPC call, can't use static ones. Socket will respond to every rpc call, so you'll want some callback system based on ID.