Skip to main content
Start a service inside a machine and call machine.get_url(port) to get the exact signed preview URL to share. Keep the machine and the server process running while someone is using the URL.
from nullspace import Machine

with Machine.create(template="base") as machine:
    server = machine.commands.run(
        "cd /workspace && python3 -m http.server 8080",
        shell=True,
        background=True,
    )
    try:
        print(machine.get_url(8080))
        input("Open the URL, then press Enter to stop the server and destroy the machine...")
    finally:
        server.kill()
Hosted preview URLs are edge-owned. The exact host and path are deployment specific; use the returned URL directly:
https://preview.your-nullspace-domain/.../?edge_token=...
Single-host OSS owned-domain installs use API-compatible wildcard preview hostnames because apps/edge is not part of that appliance profile.

HTTP and WebSocket URLs

http_url = machine.get_url(8080)
websocket_url = machine.get_websocket_url(8080)
print(http_url)
print(websocket_url)
Use the exact signed URL returned by the SDK. If the deployment returns an edge_token query parameter, do not strip or rewrite it. After opening a signed HTTP preview URL in a browser, normal page navigation can continue through the scoped preview continuation cookie. WebSocket clients should use the returned websocket_url; HTTP continuation cookies do not authorize WebSocket upgrades. Use a custom preview proxy when you need your own domain, app session checks, or proxy middleware. Concept: Create. API reference: getHost, createMachine, and execCommand.