Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Packages #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/heavy-hats-sit.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/ten-boxes-move.md

This file was deleted.

73 changes: 42 additions & 31 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
# 0.3.0

## 0.8.1

### Patch Changes

- [#53](https://github.com/smartcontractkit/wsrpc/pull/53) [`94c9fea`](https://github.com/smartcontractkit/wsrpc/commit/94c9fead7991b59a3ec1010c4392672bcfc84f00) Thanks [@erikburt](https://github.com/erikburt)! - Update dependencies

- [#53](https://github.com/smartcontractkit/wsrpc/pull/53) [`94c9fea`](https://github.com/smartcontractkit/wsrpc/commit/94c9fead7991b59a3ec1010c4392672bcfc84f00) Thanks [@erikburt](https://github.com/erikburt)! - Remove deprecated usages of protogen Annotate method

* Use context to cancel a blocking `Dial`.

```
// With timeout
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
conn, err := wsrpc.DialWithContext(ctx, "127.0.0.1:1338",
wsrpc.WithTransportCreds(privKey, serverPubKey),
wsrpc.WithBlock(),
)
ctx := context.Background()
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
conn, err := wsrpc.DialWithContext(ctx, "127.0.0.1:1338",
wsrpc.WithTransportCreds(privKey, serverPubKey),
wsrpc.WithBlock(),
)

// Manual cancel
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
go func() {
ctx, cancel := context.WithCancel(ctx)
go func() {
conn, err := wsrpc.DialWithContext(ctx, "127.0.0.1:1338",
wsrpc.WithTransportCreds(privKey, serverPubKey),
wsrpc.WithBlock(),
)}()
wsrpc.WithTransportCreds(privKey, serverPubKey),
wsrpc.WithBlock(),
)}()

// Something causes the need to cancel.
cancel()
Expand All @@ -29,37 +37,39 @@
established or dropped. You can then retrieve the latest list of keys

```
go func() {
for {
notifyCh := s.GetConnectionNotifyChan()
<-notifyCh

fmt.Println("Connected to:", s.GetConnectedPeerPublicKeys())
}
}()
go func() {
for {
notifyCh := s.GetConnectionNotifyChan()
<-notifyCh

fmt.Println("Connected to:", s.GetConnectedPeerPublicKeys())
}
}()
```

# 0.2.0

* Replace metadata public key context with with a peer context.
- Replace metadata public key context with with a peer context.

**Extracting a public key**

```
// Previously
pubKey, ok := metadata.PublicKeyFromContext(ctx)
if !ok {
return nil, errors.New("could not extract public key")
}
pubKey, ok := metadata.PublicKeyFromContext(ctx)
if !ok {
return nil, errors.New("could not extract public key")
}

// Now
p, ok := peer.FromContext(ctx)
if !ok {
return nil, errors.New("could not extract peer information")
}
if !ok {
return nil, errors.New("could not extract peer information")
}
pubKey := p.PublicKey
```

**Making a server side RPC call**

```
// Previously
ctx := context.WithValue(context.Background(), metadata.PublicKeyCtxKey, pubKey)
Expand All @@ -69,14 +79,15 @@
ctx := peer.NewCallContext(context.Background(), pubKey)
res, err := c.Gnip(ctx, &pb.GnipRequest{Body: "Gnip"})
```
* Add a `WithBlock` DialOption which blocks the caller of Dial until the underlying connection is up.

- Add a `WithBlock` DialOption which blocks the caller of Dial until the underlying connection is up.

# 0.1.1

## Changed

* Supress logging until we can implement a configurable logging solution.
- Supress logging until we can implement a configurable logging solution.

# 0.1.0

Initial release
Initial release
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chainlink/wsrpc",
"version": "0.8.0",
"version": "0.8.1",
"description": "Bi-directional communication channel using mTLS and web sockets.",
"main": "index.js",
"private": true,
Expand Down
Loading