Skip to content

Releases: smartcontractkit/wsrpc

v0.3.2

03 Aug 10:10
3f93ddd
Compare
Choose a tag to compare
  • Fixes an bug where the addrConn was not cancelled after a blocking dial is cancelled

v0.3.1

29 Jul 08:48
Compare
Choose a tag to compare
  • Fixes an issue causing a panic calling Close on the ClientConn

v0.3.0

28 Jun 10:51
41d697f
Compare
Choose a tag to compare
  • 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(),
      )
    
    // Manual cancel
    ctx := context.Background()
      ctx, cancel := context.WithCancel(ctx)
      go func() {
      conn, err := wsrpc.DialWithContext(ctx, "127.0.0.1:1338",
      	wsrpc.WithTransportCreds(privKey, serverPubKey),
      	wsrpc.WithBlock(),
      )}()
    
    // Something causes the need to cancel.
    cancel()
    
  • Subscribe to a notification channel to get updates when a client connection is
    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())
      	}
      }()
    

v0.2.0

22 Jun 09:15
Compare
Choose a tag to compare

Improvements to the API for extracting public key information and adds a blocking dialoption

BREAKING CHANGE

  • 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")
      }
    
      // Now
      p, ok := peer.FromContext(ctx)
      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)
    res, err := c.Gnip(ctx, &pb.GnipRequest{Body: "Gnip"})
    
    // Now
    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.

v0.1.1

18 Jun 06:22
29dbe71
Compare
Choose a tag to compare

Changed

  • Suppress logging until we can implement a configurable logging solution.

v0.1.0

17 Jun 00:39
21b6805
Compare
Choose a tag to compare
v0.1.0 Pre-release
Pre-release

Initial release