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:
reset- takes no parameters, sets count back to 0setCount- takes avalueparameter, sets count to that value
Both should publish the new count and return it.
WebSocket
0
No messages yet