libsoratun
The C library allows you to embed Soracom Arc connectivity into your own program. You can send a message to the unified endpoint, with Soracom Arc, entirely from userspace (no root privilege is required).
Tested Setup
- Go 1.21.5 darwin/arm64
- macOS Sonoma 14.1.2
Prerequisites
- You have to have a virtual SIM, along with
arc.json
which is a configuration file for soratun
locally. See documentation for detail.
- You have to enable the unified endpoint for your SIM group. See documentation for detail.
Build
$ git clone https://github.com/soracom/libsoratun
$ cd libsoratun
$ make libs
Run Examples
Python
Tested with Python 3.12.0.
$ cd examples/python
$ python3 main.py /path/to/arc.json '{"message": "hey"}'
Node.js
Tested with Node.js v18.19.0.
$ cd examples/nodejs
$ npm install
$ node src/index.js /path/to/arc.json '{"message": "hey"}'
Rust
Tested with Rust 1.74.1. In order to build Rust bindings, you have to install bindgen-cli and its prerequisites.
$ make bindings
$ cd examples/rust
$ cargo run -- --config /path/to/arc.json '{"message": "hey"}'
AWS Lambda
Tested with AWS Lambda Python 3.11 runtime.
-
Build a shared library on target platform. Tested on arm64.
$ make libs
-
Place examples/lamdada/lambda_function.py
, lib/shared/libsoratun.so
, and your arc.json
in a same directory.
-
Zip it up and upload it to AWS Lambda function.
$ zip -r lambda.zip lambda_function.py libsoratun.so arc.json
License
MIT. See LICENSE for detail.