These examples won’t run in the playground.


This is an advanced topic.

You can host a Clio project using clio host command, you’ll be able to import the functions you hosted over the network, on server or in the browser. Let’s define a function and host it:

title = "host-example"
description = ""
version = "0.1.0"
license = "MIT"
main = "src/main.clio"
authors = [ "Your Name <>" ]
keywords = ""

directory = "build"
target = "node"

directory = "src"
target = "node"

test = "No tests specified"

stdlib = "latest"

proto = "ws"
port = 1337
host = ""
name = "default"

proto = "ws"
url = "ws://localhost:1337"
count = "cpu"
server = "default"

proto = "ws"
url = "ws://localhost:1337"
wait_for = "cpu"
server = "default"

Running clio host in the root directory of the project will host the project. We can import this in another project:

You can see full examples in our examples repository.