good morning!!!!

Skip to content
Snippets Groups Projects
Verified Commit 96bdcbb3 authored by a's avatar a
Browse files

remove another

parent a4046f9a
No related branches found
No related tags found
2 merge requests!15Draft: V2,!13Draft: Move Openrpc Package
......@@ -6,24 +6,9 @@ import (
"gfx.cafe/util/go/bufpool"
json "github.com/goccy/go-json"
jsoniter "github.com/json-iterator/go"
"nhooyr.io/websocket"
)
var JZON = jsoniter.Config{
IndentionStep: 0,
MarshalFloatWith6Digits: false,
EscapeHTML: true,
SortMapKeys: true,
UseNumber: false,
DisallowUnknownFields: false,
TagKey: "",
OnlyTaggedField: false,
ValidateJsonRawMessage: false,
ObjectFieldMustBeSimpleString: false,
CaseSensitive: false,
}.Froze()
// Read reads a JSON message from c into v.
// It will reuse buffers in between calls to avoid allocations.
func Read(ctx context.Context, c *websocket.Conn, v interface{}) error {
......@@ -59,10 +44,8 @@ func write(ctx context.Context, c *websocket.Conn, v interface{}) (err error) {
if err != nil {
return err
}
st := JZON.BorrowStream(w)
defer JZON.ReturnStream(st)
st.WriteVal(v)
err = st.Flush()
st := json.NewEncoder(w)
err = st.Encode(v)
if err != nil {
return fmt.Errorf("failed to marshal JSON: %w", err)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment