Welcome to Port

More Easily Create an API-Server with Port App, designed to streamline the deployment of pkgs for developers. With this tool, developers can effortlessly deploy pkgs and integrate various applications to build a unified web service. Port Application simplifies the process, enabling developers to focus on creating seamless and efficient solutions with ease.

Please see the documentation lincense

The Requirements


Tip

System Requirements .sdk-8.0.403-windows-x64-installer

Download URL


VERSION OS STABLE URL
v1.0.27 Windows x64 Yes v1.0.27-win-installer

Project Layout


The Port project is remarkably simple and straightforward. To get started, first create a project folder in the console, then type port new sample. This will quickly generate the project files. After that, create sub-group folders and add .msg files to each sub-group folder. Feel free to create messages using text, num, and enum types as you like. Once you've specified the attributes, type port push and Port will automatically store everything. Now, just run port run sample, and the server will start, allowing you to safely and easily share messages across multiple applications.

Repository

port new [name]

Layout

port.toml         # The configuration file.
.enum             # The custom enum file 
pkg-A-Group/      # The group directory. 
    sample1.msg   # The message file
    sample2.msg   # The message file
    sample3.msg   # The message file

pkg-B-Group/      # The group directory. 
    sample1.msg   # The message file
    sample2.msg   # The message file
    sample3.msg   # The message file
...               # Other files.

Tip

The repository name cannot contain special characters. It follows the directory naming rules provided by the operating system.


Group

A group serves as the root of messages. Within a single group, multiple message files can be stored, allowing for easy retrieval and editing. By managing several .msg files within the group folder, you can conveniently organize and abstract them for streamlined management.

port add --group [name]


Message (*.msg)

A message is an object that allows users to specify pkg properties in a pre-provided Application Service. The message is a kv, and types and properties can be defined in that message. Please attach the materials attached below.


datatype

name range description
text 0~255 The length can be specified as a value from 0 to 255.
num -1.7e+308 ~

+1.7e+308

The floating-point type that allows for the representation of decimal numbers and is capable of representing a wide range of values, both very small and very large.
enum 0 ~ 65535 The user can utilize the fixed list values specified in the .enum file, which can be used at a lower cost than text values and with stricter usage.


attribute

name description
pkg Real-time synchronization and messaging are handled within the corresponding external library. For more details, please refer to the pkg documentation.
backup Changes are saved to the backup database as they occur, ensuring that values are restored upon application restart. and values are not propagated pkg messages during program execution.
property Can specify a custom property
rule Can specify rules to manage the values of corresponding messages.


sample1.msg

 DevAPowerStatus    enum.DeviceAStatus  pkg:DeviceA.GetStatus         
 DevAErrorMessage   text                pkg:DeviceA.GetErrorMessage property:{"Arguments":"1,0"}
 DevCTemperature    num                 pkg:DeviceC.GetTemperature property:{"MIN":0,"MAX":300}
 DevCOnOff          enum.OnOff          pkg:DeviceC.OnOff           
 ...

Tip

message document do not using special characters.



Enum (*.enum)


Enums are particularly useful when you have a fixed set of values that a variable can take, such as days of the week, months of the year, or status codes. They help make your code more expressive, self-documenting, and less error-prone because you're working with named constants instead of raw integer values.

custom.enum

TFalse      True:0      False:1
FTrue       False:0     True:1

Commands


Cheat Sheet

command arguments description
? [script] Runs the specified script.
version - Displays the version information.
new [name] Can specify rules to manage the values of corresponding messages.
push - Push project to repository.
pull - Pull project from repository.
set [group-name|pkg-name] [message-name] [value] Set values in the pkg server.
get [group-name|pkg-name] [message-name] Get values from the pkg server.
build [pkg-name] [--path <build-path>]|[--o <output package-name>] Build package
init [pkg-name] Initializes the Package.
event [pkg-name] Displays a events.
run [name] Runs the pkg server based on the specified repository.
ls [repo]|[pkg]|[tcp]|[comm] Displays the specified items in a list.
queue

[new] [name]

[ls]

[view] [name]

[push] [name] [value]

[pop] [name]

Create new queue.

Displays queue list.

Displays queue items.

Push a item to queue.

Pop a item from queue.

stack

[new] [name]

[ls]

[view] [name]

[push] [name] [value]

[pop] [name]

Create new stack.

Displays stack list.

Displays stack items.

Push a item to stack.

Pop a item from stack.

storage

[new] [name]

[ls]

[view] [name]

[set] [name] [key] [value]

[get] [name] [key]

Create new storage.

Displays storage list.

Displays storage items.

Push a item to storage.

Pop a item from storage.

list

[new] [name]

[ls]

[view] [name]

[add] [name] [value]

[insert] [name] [index] [value]

[remove] [name] [index] [value]

Create new list.

Displays a lists.

Displays list items.

Add a item.

Insert a item.

Remove a item.

kill [kill-code] Shutdown pkg server.
flow

[load] [flow-key]

[init] [flow-key]

[remove] [flow-key]

[event] [flow-key]

Loads the Flow resource into the currently running pkg server.

Initializes the Flow resource.

Remove Flow resource

Displays a events from the Flow resource.

env - Displays the system environment settings.
help - .

Repository

Tip

The application runs based on the values stored in the repository. The push action must precede the application startup. Subsequently, users can perform a pull action at any desired moment to restore the repository.

Server

Message

port set groupA sayHelloMessage1 Hello?
[set-ok]
port get groupA sayHelloMessage1
[Hello?]