You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I can't get the client to receive a message from the server. Here's my code:
Meteor.startup(() => {
if (Meteor.isServer) {
let protocol = JsonProtocol.getInstance();
protocol.on('myMessage', (data, sessionId) => {
console.log('server received message', data, sessionId);
protocol.send('myMessage', { 'myData': `to send from server to ${sessionId}`, sessionId });
});
}
});
On the client:
Template.myTemplate.onRendered(function () {
let protocol = JsonProtocol.getInstance();
console.log('about to send message');
protocol.send('myMessage', { 'myData': 'to send from client' });
protocol.on('myMessage', (data) => {
console.log('client received message', data);
});
});
The console logs show that the server receives the message from the client, but the client does not receive the message from the server. This looks like a great package if I could only figure out how to get this working? Thanks!
The text was updated successfully, but these errors were encountered:
You have a mistake in the syntax. Sorry, the server part should be throwing in this case.
You have: protocol.send('myMessage', { 'myData': 'to send from server to ${sessionId}', sessionId });
You should have: protocol.send('myMessage', { 'myData': 'to send from server to ${sessionId}' }, sessionId);
Hi, I can't get the client to receive a message from the server. Here's my code:
On the client:
The console logs show that the server receives the message from the client, but the client does not receive the message from the server. This looks like a great package if I could only figure out how to get this working? Thanks!
The text was updated successfully, but these errors were encountered: