Skip to content

gsd-build/protocol-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

protocol-go

Go types for the GSD Cloud wire protocol — the message format the daemon and relay use to talk to each other over websockets.

Install

go get github.com/gsd-build/protocol-go

Usage

import (
    "encoding/json"

    protocol "github.com/gsd-build/protocol-go"
)

// Decode an incoming frame:
env, err := protocol.ParseEnvelope(data)
if err != nil {
    // handle error
}
switch msg := env.Payload.(type) {
case *protocol.Hello:
    _ = msg.MachineID
case *protocol.Task:
    _ = msg.Prompt
}

// Encode an outgoing frame — marshal the payload struct directly:
data, _ := json.Marshal(&protocol.Hello{
    Type:      protocol.MsgTypeHello,
    MachineID: "machine-1",
})

See PROTOCOL.md for the wire format specification.

License

MIT — see LICENSE.

About

Wire protocol types for the GSD Cloud daemon ↔ relay connection

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages