1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-18 02:17:05 +00:00

MVC improvements: add HandleWebsocket that now registers events automatically based on the struct's methods(!) and fix a bug when more than one value of the same type is registered to a static field of a controller

Former-commit-id: e369d1426ac1a6b58314930a18362670317da3c1
This commit is contained in:
Gerasimos (Makis) Maropoulos
2019-07-09 12:16:19 +03:00
parent 85666da682
commit 450f20902d
18 changed files with 383 additions and 183 deletions

View File

@@ -53,13 +53,15 @@ var (
//
// See examples for more.
Dial = neffos.Dial
// IsTryingToReconnect reports whether the returning "err" from the `Server#Upgrade`
// is from a client that was trying to reconnect to the websocket server.
//
// Look the `Conn#WasReconnected` and `Conn#ReconnectTries` too.
IsTryingToReconnect = neffos.IsTryingToReconnect
// NewStruct returns the `Struct` Conn Handler based on ptr value.
NewStruct = neffos.NewStruct
// JoinConnHandlers combines two or more ConnHandlers as one.
JoinConnHandlers = neffos.JoinConnHandlers
// OnNamespaceConnect is the event name which its callback is fired right before namespace connect,
// if non-nil error then the remote connection's `Conn.Connect` will fail and send that error text.
// Connection is not ready to emit data to the namespace.

View File

@@ -39,7 +39,8 @@ type (
// i.e on `OnNamespaceConnect` it will abort a remote namespace connection.
// See examples for more.
MessageHandlerFunc = neffos.MessageHandlerFunc
// ConnHandler is the interface which namespaces and events can be retrieved through.
ConnHandler = neffos.ConnHandler
// Events completes the `ConnHandler` interface.
// It is a map which its key is the event name
// and its value the event's callback.
@@ -63,6 +64,11 @@ type (
//
// See `New` and `Dial`.
WithTimeout = neffos.WithTimeout
// Struct completes the `ConnHandler` interface.
// It uses a structure to register a specific namespace and its events.
Struct = neffos.Struct
// StructInjector can be used to customize the value creation that can is used on serving events.
StructInjector = neffos.StructInjector
// The Message is the structure which describes the incoming and outcoming data.
// Emitter's "body" argument is the `Message.Body` field.
// Emitter's return non-nil error is the `Message.Err` field.