gotalk

Async peer communication protocol & library

MIT License

Downloads
17
Stars
1.2K
Committers
2

Bot releases are visible (Hide)

gotalk - v1.3.7 Latest Release

Published by rsms almost 4 years ago

Updates the embedded gotalk.js to v1.2.1

gotalk - v1.3.6

Published by rsms almost 4 years ago

Updates the embedded gotalk.js to v1.2.0

gotalk - v1.3.5

Published by rsms almost 4 years ago

Adds Handlers.NewSubHandlers() which returns a wrapper

// NewSubHandlers returns a new Handlers object which wraps the receiver.
// It can be used to override or extend h, without modifying h.
// For example, it could be used to expose an extra set of operations to certain sockets,
// like signed-in users.
func (h *Handlers) NewSubHandlers() *Handlers
gotalk - v1.3.4

Published by rsms almost 4 years ago

Adds ability to customize error logging with gotalk.ErrorLogger and gotalk.HandlerErrorLogger which both have the type gotalk.LoggerFunc

Example:

gotalk.HandlerErrorLogger = func(s *gotalk.Sock, format string, args ...interface{}) {
  myLogger.Warn("[gotalk %p] " + format, append([]interface{}{s}, args...)...)
}
gotalk - v1.3.3

Published by rsms almost 4 years ago

Adds method Sock.IsClosed() bool

gotalk - v1.3.1

Published by rsms almost 4 years ago

Adds type WebSocketConnection which is an alias for golang.org/x/net/websocket.Conn along with documentation about how to access the underlying web socket connection inside a gotalk handler.

gotalk - v1.3.0

Published by rsms almost 4 years ago

API changes in version 1.3 compared to 1.2

  • Limits is no longer an interface but not a plain struct with fields
    you can set and edit. This simplifies the code and makes the API easier to use.

  • Limits now exposes wait times as BufferMinWait, BufferMaxWait,
    StreamMinWait and StreamMaxWait. These values default to the same as in
    Gotalk 1.2 (500–5000ms.)

  • The string message of ErrSockClosed has been changed to "socket closed"
    (was "socket is closed")

Other changes:

  • Fixes a race condition with closing sockets which could lead to CloseHandler
    being called twice in case two user goroutines would call Sock.Close()

  • Fixes a race condition that could lead to a deadlock when sending requests and
    waiting for responses.

gotalk - v1.2.1

Published by rsms about 4 years ago

Go library: Adds the ability to gracefully shut down sockets via a new method Socket.Shutdown (low level). Note that Web Socket-based gotalk does not need this.

JS library: Increases the minimum reconnect delay after a clean connection close in keepalive. This has no effect on the API and no effect on semantics. When a server restarts and cleanly shuts down sockets, avoid slamming the server immediately with connection attempts. A future version might introduce randomness to this delay as well.

gotalk - v1.2.0

Published by rsms about 4 years ago

Improvements to the Sock and WebSocketServer API:

  • WebSocketServer now uses a WebSocket struct type instead of Sock; a specialized derivative of Sock with methods for accessing the underlying web socket and http connection.

  • Adds new callback WebSocketServer.OnConnect, deprecating OnAccept. OnConnect receives a WebSocket struct rather than a Sock struct as is the case with OnAccept (i.e. why OnConnect was added instead of using OnAccept.)

  • Adds method Sock.String() which returns a name that uniquely identifies the socket during its lifetime. Useful for logging.

  • Deprecates the function WebSocketHandler() in favor for a better-named NewWebSocketServer(). Functionality is unchanged.

gotalk - v1.1.5

Published by rsms about 4 years ago

Addresses an issue in the JavaScript library where in certain conditions an exception "Can't find variable: protocol" would be thrown. This release contains no changes to the go library.

gotalk - v1.1.4

Published by rsms about 4 years ago

Very minor update that makes it possible to use a zero Handlers struct instead of going through the NewHandlers function. This makes it easier to allocate Handlers for example as part of another, parent struct.

Example:

type MyThing struct {
  Gotalk gotalk.Handlers
  myOtherThing Thing
}
func main() {
  thing := MyThing{}
  thing.Gotalk.Handle("foo", ...)
  thing.Start()
}
func (m *MyThing) Start() {
  gotalk := gotalk.WebSocketHandler()
  gotalk.Handlers = &m.Gotalk
}

Prior to v1.1.4 you would have to do something like this instead, allocating a Handlers struct via the NewHandlers function:

type MyThing struct {
  Gotalk *gotalk.Handlers
  myOtherThing Thing
}
func NewMyThing() *MyThing {
  return &MyThing{ Gotalk: gotalk.NewHandlers() }
}
func main() {
  thing := NewMyThing()
  thing.Gotalk.Handle("foo", ...)
  thing.Start()
}
func (m *MyThing) Start() {
  gotalk := gotalk.WebSocketHandler()
  gotalk.Handlers = &m.Gotalk
}
gotalk - v1.1.3

Published by rsms about 4 years ago

Improvements to the JavaScript library

gotalk.defaultResponderAddress can now be set to a partial URL, like a path or a hostname without protocol. Examples of acceptable values:

  • ws://host/path -- fully qualified. What was previously required.
  • //host/path -- match protocol script is served over (ws for http, wss for https)
  • /path -- automatic protocol and hostname script is served over/from

A warning message is now printed to the console when gotalk.developmentMode is true and connection to gotalk websocket server fails, with a helpful message about gotalk.defaultResponderAddress.

New property gotalk.developmentMode can be set to true to enable aforementioned warning message. It also enables console.error calls with full error information for handler exceptions and messaging errors. gotalk.developmentMode defaults to true when the script is served from localhost, otherwise its value is false by default.

gotalk - v1.1.2

Published by rsms about 4 years ago

This release only contains improvements to the built-in JS library:

  • New version of JS library itself (see gotalk/js)
  • Simplified serving of the js file over HTTP, including some minor performance improvements
  • Delivers the js file with gzip compression if the HTTP client accepts it
  • No longer includes nor loads the large js.map file into memory
gotalk - v1.1.1

Published by rsms about 4 years ago

Only metadata changes (readme and license), mainly for godoc/pkg.go.dev

gotalk -

Published by rsms about 4 years ago

Changelog start and first version as a go module

gotalk -

Published by rsms about 4 years ago

  • Adds Version constant (gotalk.Version string)
gotalk - v1.1.0

Published by rsms about 4 years ago

  • Exposes net.Listener on Server.Listener (previously private)
  • Adds ListenTLS and ListenTLSCustom functions for starting servers with TLS
  • Adds ConnectTLS and Sock.ConnectTLS functions for connecting with TLS
  • Adds Sock.ConnectReader function for connecting over any io.ReadWriteCloser
  • Adds Server.EnableUnixSocketGC convenience helper function
  • Adds TLSCertPool and TLSAddRootCerts functions for customizing default TLS config
  • Semantic change to UNIX socket transport: gotalk no longer installs a signal handler
    when listening over a UNIX socket using the function Listen("unix", ...).
    If you want to retain that functionality, explicitly call Server.EnableUnixSocketGC
    on the server returned by Listen("unix", ...).