0/24
1. Hello, Live

Lesson 1: Hello, Live

svelte-realtime lets you call server functions from your components as if they were local.

On the right you see two files:

  • src/live/greet.ts - a server function wrapped with live()
  • src/routes/+page.svelte - your component

The server file is already done. The greet function takes a name and returns a greeting. Your job is to call it from the component.

Try it

  1. Import greet from '$live/greet'
  2. Add a button that calls greet('World') and sets message to the result

Since greet runs on the server, it's an async function - use await when calling it.

WebSocket
0
No messages yet
/