
Security News
Nx npm Packages Compromised in Supply Chain Attack Weaponizing AI CLI Tools
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Ably is the platform that powers synchronized digital experiences in realtime. Whether attending an event in a virtual venue, receiving realtime financial information, or monitoring live car performance data – consumers simply expect realtime digital experiences as standard. Ably provides a suite of APIs to build, extend, and deliver powerful digital experiences in realtime for more than 250 million devices across 80 countries each month. Organizations like Bloomberg, HubSpot, Verizon, and Hopin depend on Ably’s platform to offload the growing complexity of business-critical realtime data synchronization at global scale. For more information, see the Ably documentation.
This is a Rust client library for the Ably REST API. It does not currently include any realtime features.
NOTE: This SDK is a developer preview and not considered production ready.
Add the ably
and tokio
crates to your Cargo.toml
:
[dependencies]
ably = "0.2.0"
tokio = { version = "1", features = ["full"] }
Initialize a client with a method to authenticate with Ably.
let client = ably::Rest::from("xVLyHw.SmDuMg:************");
let auth_url = "https://example.com/auth".parse()?;
let client = ably::ClientOptions::new().auth_url(auth_url).client()?;
Given:
let channel = client.channels.get("test");
let result = channel.publish().string("a string").send().await;
#[derive(Serialize)]
struct Point {
x: i32,
y: i32,
}
let point = Point { x: 3, y: 4 };
let result = channel.publish().json(point).send().await;
let data = vec![0x01, 0x02, 0x03, 0x04];
let result = channel.publish().binary(data).send().await;
let mut pages = channel.history().pages();
while let Some(Ok(page)) = pages.next().await {
for msg in page.items().await? {
println!("message data = {:?}", msg.data);
}
}
let mut pages = channel.presence.get().pages();
while let Some(Ok(page)) = pages.next().await {
for msg in page.items().await? {
println!("presence data = {:?}", msg.data);
}
}
let mut pages = channel.presence.history().pages();
while let Some(Ok(page)) = pages.next().await {
for msg in page.items().await? {
println!("presence data = {:?}", msg.data);
}
}
When a 128 bit or 256 bit key is provided to the library, the data attributes of all messages are encrypted and decrypted automatically using that key. The secret key is never transmitted to Ably. See https://www.ably.com/documentation/realtime/encryption
// Initialize a channel with cipher parameters so that published messages
// get encrypted.
let cipher_key = ably::crypto::generate_random_key::<ably::crypto::Key256>();
let params = ably::rest::CipherParams::from(cipher_key);
let channel = client.channels.name("rust-example").cipher(params).get();
channel
.publish()
.name("name is not encrypted")
.string("sensitive data is encrypted")
.send()
.await;
let result = client
.auth
.request_token()
.client_id("test@example.com")
.capability(r#"{"example":["subscribe"]}"#)
.send()
.await;
let mut pages = client.stats().pages();
while let Some(Ok(page)) = pages.next().await {
for stats in page.items().await? {
println!("stats = {:?}", stats);
}
}
FAQs
Unknown package
We found that ably demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.