good morning!!!!
Skip to content
GitLab
Explore
Sign in
Commits on Source (1)
fix client
· fd87172c
a
authored
Sep 07, 2023
fd87172c
Hide whitespace changes
Inline
Side-by-side
example/client/main.go
View file @
fd87172c
...
...
@@ -8,7 +8,7 @@ import (
)
func
main
()
{
client
,
err
:=
jrpc
.
Dial
(
"
ws://localhost:8545
"
)
client
,
err
:=
jrpc
.
Dial
(
"
https://mainnet.boba.network/
"
)
if
err
!=
nil
{
panic
(
err
)
}
...
...
pkg/codec/json.go
View file @
fd87172c
...
...
@@ -163,10 +163,10 @@ func (m *Message) UnmarshalJSON(xs []byte) error {
return
UnmarshalMessage
(
m
,
dec
)
}
func
(
m
*
Message
)
MarshalJSON
()
([]
byte
,
error
)
{
func
(
m
Message
)
MarshalJSON
()
([]
byte
,
error
)
{
buf
:=
&
bytes
.
Buffer
{}
enc
:=
jx
.
NewStreamingEncoder
(
buf
,
4096
)
err
:=
MarshalMessage
(
m
,
enc
)
err
:=
MarshalMessage
(
&
m
,
enc
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
pkg/codec/reqresp.go
View file @
fd87172c
...
...
@@ -41,11 +41,11 @@ type Request struct {
}
func
(
r
*
Request
)
UnmarshalJSON
(
xs
[]
byte
)
error
{
return
json
.
Unmarshal
(
xs
,
&
r
.
Message
)
return
r
.
Message
.
Unmarshal
JSON
(
xs
)
}
func
(
r
*
Request
)
MarshalJSON
()
([]
byte
,
error
)
{
return
json
.
Marshal
(
r
.
Message
)
func
(
r
Request
)
MarshalJSON
()
([]
byte
,
error
)
{
return
r
.
Message
.
MarshalJSON
(
)
}
func
NewRequestFromMessage
(
ctx
context
.
Context
,
message
*
Message
)
(
r
*
Request
)
{
...
...