0/24
5. RPC Parameters

Lesson 5: RPC Parameters

RPCs can accept arguments just like normal functions. After ctx, add any parameters you need:

export const setName = live((ctx, name) => {
  // name comes from the client call
});

The client calls it with: await setName('Alice')

Try it

Add two new functions to the counter:

  1. reset - takes no parameters, sets count back to 0
  2. setCount - takes a value parameter, sets count to that value

Both should publish the new count and return it.

WebSocket
0
No messages yet
/