rpc

package
v0.0.0-...-35a654b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package rpc implements the RPC protocol for the seltabl language server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeMessage

func DecodeMessage(msg []byte) (string, []byte, error)

DecodeMessage decodes a rpc message

func EncodeMessage

func EncodeMessage(msg any) (string, error)

EncodeMessage encodes a message into a string

It uses the json library to encode the message and returns a string representation of the encoded message with a Content-Length header.

It also returns an error if there is an error while encoding the message.

func Split

func Split(data []byte, _ bool) (int, []byte, error)

Split splits a byte slice into a header and content

Types

type BaseMessage

type BaseMessage struct {
	Testing bool   `json:"testing"`
	Method  string `json:"method"`
}

BaseMessage is the base message for a rpc message

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL