Skip to content

Commit

Permalink
Version Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
app-token-issuer-foundations[bot] authored Feb 29, 2024
1 parent f56acb0 commit ba3e39f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 42 deletions.
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

0 comments on commit ba3e39f

Please sign in to comment.