Sign in

    #proton/ipc

    moonbit-community/proton/ipc defines transport-neutral protocol types for Proton.

    It does not know about WebView, WebSocket, process launch, or extension code. The current root facade uses these types with the native DLL bridge.

    IpcError

    pub(all) suberror IpcError {
    MalformedJson(detail~ : String)
    InvalidPayload(kind~ : String, detail~ : String)
    UnsupportedVersion(scope~ : String, actual~ : Int, supported~ : Int)
    EmptyField(path~ : String)
    InvalidErrorResponseBody
    } derive(Eq,
    Debug
    )

    Failures while decoding or validating Proton IPC protocol values.

    IpcError::message

    fn IpcError::message(self : IpcError) -> String

    IpcExtensionApi

    pub(all) struct IpcExtensionApi {
    api_name : String
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    One JavaScript-facing API exposed for a remote extension namespace.

    IpcExtensionApi::new

    fn IpcExtensionApi::new(api_name : String) -> IpcExtensionApi

    Creates one remote extension API descriptor.

    IpcExtensionDescriptor

    pub(all) struct IpcExtensionDescriptor {
    id : String
    js_namespace : String
    apis : Array[IpcExtensionApi]
    scripts : Array[String]
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    JavaScript bridge metadata for one remote extension.

    IpcExtensionDescriptor::new

    fn IpcExtensionDescriptor::new(id : String, js_namespace : String, apis : Array[IpcExtensionApi], scripts? : Array[String]) -> IpcExtensionDescriptor

    Creates one remote extension bridge descriptor.

    IpcExtensionEvent

    pub(all) struct IpcExtensionEvent {
    version : Int
    extension_namespace : String
    event_name : String
    payload : Json
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    One extension event sent from the user process to JavaScript.

    IpcExtensionEvent::new

    fn IpcExtensionEvent::new(extension_namespace : String, event_name : String, payload : Json) -> IpcExtensionEvent

    Creates one extension event IPC frame.

    IpcExtensionEvent::validate

    Validates one decoded extension event.

    IpcOpRequest

    pub(all) struct IpcOpRequest {
    version : Int
    id : String
    name : String
    payload : Json
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    One operation invocation sent from the JavaScript bridge to the user process.

    IpcOpRequest::new

    fn IpcOpRequest::new(id : String, name : String, payload : Json) -> IpcOpRequest

    Creates one operation request frame.

    IpcOpRequest::stringify

    fn IpcOpRequest::stringify(self : IpcOpRequest) -> String

    Serializes an operation request as one JSON IPC payload.

    IpcOpRequest::validate

    fn IpcOpRequest::validate(self : IpcOpRequest) -> IpcOpRequest raise IpcError

    Validates one decoded operation request.

    IpcOpResponse

    pub(all) struct IpcOpResponse {
    version : Int
    id : String
    status : Int
    body : Json
    } derive(Eq, ToJson,
    Debug
    ,
    FromJson
    )

    One operation completion sent from the user process back to JavaScript.

    status == 0 means success. Any non-zero status means body contains a JSON string error message suitable for rejecting the JavaScript promise.

    IpcOpResponse::err

    fn IpcOpResponse::err(id : String, message : String) -> IpcOpResponse

    Creates one failed operation response frame.

    IpcOpResponse::is_ok

    fn IpcOpResponse::is_ok(self : IpcOpResponse) -> Bool

    Returns whether this response represents success.

    IpcOpResponse::ok

    fn IpcOpResponse::ok(id : String, body : Json) -> IpcOpResponse

    Creates one successful operation response frame.

    IpcOpResponse::stringify

    fn IpcOpResponse::stringify(self : IpcOpResponse) -> String

    Serializes an operation response as one JSON IPC payload.

    IpcOpResponse::validate

    fn IpcOpResponse::validate(self : IpcOpResponse) -> IpcOpResponse raise IpcError

    Validates one decoded operation response.

    parse_ipc_op_request

    fn parse_ipc_op_request(raw : String) -> IpcOpRequest raise IpcError

    Parses one JSON IPC operation request.

    parse_ipc_op_response

    fn parse_ipc_op_response(raw : String) -> IpcOpResponse raise IpcError

    Parses one JSON IPC operation response.

    protocol_version

    fn protocol_version() -> Int

    Returns the protocol version used in all IPC envelopes and payloads.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io