A modern, fast and scalable websocket framework with elegant API written in Go
Message.SetBinary
Message.SetBinary
for incoming messages using the operation code that the lower level protocol gave usRelative: https://github.com/kataras/neffos.js/commit/b5a916ec41193f320d5bcd276598e2e5ecfc795c
Contains two fixes
Server.Broadcast
call inside Server.OnConnect
callback when Server.UseStackExchange
is used.Server.SyncBroadcaster
which, if set to true, changes the default behavior and sync Server.Broadcast
calls when Server.StackExchange
is nil (or Server.UseStackExchange
is not used). When StackExchange is used then this field is ignored, published messages were correctly handled by Redis or Nats already.On
helper method on Events
and Namespaces
.NSConn.JoinRoom
and LeaveRoom
to work synchronously inside event message handlers/callbacks.Subject
prefix of the stackexchange/nats
.stackexchange/nats
subpackage, among with Redis from previous version.Server.Ask
which will block until/wait for a response from a specific client if msg.To
is filled or from the first responder from either the cloud(if StackExchange is used) or from this server instance's connected clients, ofc you should still use the Conn.Ask
if you know the client to ask from.Commits log:
Add support for scaling-out with 3 lines of code. A new interface type of StackExchange
is created and it's used on server and server connections if registered through Server.StackExchange
field. A built-in redis StackExchange using a lightweight library is available for use.
Example:
import "github.com/kataras/neffos/stackexchange/redis"
// [server := neffos.New...]
exc, err := redis.NewStackExchange(redis.Config{}, "MyChatApp")
if err != nil {
// [...]
}
server.StackExchange = exc
Critical Commits:
Request by:
Export the ability of custom ConnHandlers and a lot of improvements that allow external packages to interact with the (NewStruct) feature, an example of this is the Iris' new v11.2+ fully featured MVC websocket controller.
Minimum Go Installed required version is set to 1.12.
Critical commits:
Improvements of the neffos.NewStruct connection handler.
EnableDebug(nil_or_custom_printer)
the neffos.NewStruct
will log which field is marked as static, which method is handling a specific event and etc.Events() neffos.Events
is added to the return value of the neffos.NewStruct
in order to handle that struct as raw neffos.Events
- this adds support to wrap one or more "controllers" on a neffos.Namespaces
or neffos.WithTimeout
connection handler. Note that when Events()
is used then its SetNamespace
and SetTimeouts
have no effect because they should be handled by the parent level instead.Example Code:
var events = neffos.Namespaces{
"ns1": neffos.NewStruct(new(myWebsocketController)).Events(),
"ns2": neffos.Events{...},
}
Have fun!
Add a neffos.NewStruct
to convert struct's methods to events. Read more at: https://github.com/kataras/neffos/wiki/Getting-started#using-a-struct-value
And add a customID string
input argument to the neffos.Upgrade
which iris is using to make it compatible. The neffos users can use the whole Server as a http.Handler through its ServeHTTP
method ofc.