Skip to main content

Overview

The operations module provides the core functions for working with Speckle data: sending objects to transports, receiving them back, and serializing/deserializing for custom workflows.

Principal Operations

send()

Send a Base object to one or more transports.
Parameters:
Base
required
The object to send
List[AbstractTransport]
default:"None"
Where to send the object. Defaults to local cache only.
bool
default:"True"
Whether to also save to the local SQLite cache
Returns:
str
The object ID (hash) of the sent object
Examples:
When you send an object, all nested Base objects are automatically sent too. You don’t need to send them separately.

receive()

Receive a Base object from a transport.
Parameters:
str
required
The ID of the object to receive
AbstractTransport
default:"None"
The transport to receive from (e.g., ServerTransport)
AbstractTransport
default:"None"
The local cache to check first. Defaults to SQLiteTransport
Returns:
Base
The received object, fully recomposed with all children
Examples:
receive() automatically reconstructs the entire object tree. All referenced child objects are fetched and recomposed.

Serialization

Note: The serialize() and deserialize() functions below are included for completeness, but most developers won’t need them directly. The send() and receive() operations handle serialization and deserialization implicitly. Use these functions only when you need custom workflows like saving objects to files or working with JSON representations directly.

serialize()

Serialize a Base object to a JSON string.
Parameters:
Base
required
The object to serialize
List[AbstractTransport]
default:"None"
Transports to write detached objects to. If None, objects are serialized inline without detachment
Returns:
str
JSON string representation of the object
Examples:
Without write transports, large nested objects are serialized inline, which can result in huge JSON strings. Use write transports for large objects.

deserialize()

Deserialize a JSON string back into a Base object.
Parameters:
str
required
JSON string to deserialize
AbstractTransport
default:"None"
Transport to read detached/referenced objects from. Defaults to SQLiteTransport
Returns:
Base
The deserialized object
Examples:
If the JSON contains references (like "@displayValue": "hash123..."), you must provide a read_transport that contains those referenced objects.

Detachment and Chunking

Large objects are automatically optimized during send:
Objects like Mesh have predefined chunking and detachment rules. See the Mesh documentation for details.

Best Practices

Always let the local cache work for you:
Network operations can fail:
Be careful with deserialization:
Choose the right transport for your use case:

Summary

The operations module provides four essential functions:
  • send() - Send objects to transports with automatic chunking/detachment
  • receive() - Receive and recompose objects from transports
  • serialize() - Convert objects to JSON strings
  • deserialize() - Convert JSON strings back to objects
These operations are the foundation of all Speckle data workflows!

Next Steps

Transports

Learn about different transport types

SpeckleClient

Client for server authentication and resources
Last modified on July 18, 2026