Added Created at to connection.
This commit is contained in:
+6
-3
@@ -5,21 +5,24 @@
|
|||||||
package ipe
|
package ipe
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
log "github.com/golang/glog"
|
log "github.com/golang/glog"
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
)
|
)
|
||||||
|
|
||||||
// An User Connection
|
// An User Connection
|
||||||
type connection struct {
|
type connection struct {
|
||||||
SocketID string
|
SocketID string
|
||||||
Socket *websocket.Conn
|
Socket *websocket.Conn
|
||||||
|
CreatedAt time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Subscriber
|
// Create a new Subscriber
|
||||||
func newConnection(socketID string, s *websocket.Conn) *connection {
|
func newConnection(socketID string, s *websocket.Conn) *connection {
|
||||||
log.Infof("Creating a new Subscriber %+v", socketID)
|
log.Infof("Creating a new Subscriber %+v", socketID)
|
||||||
|
|
||||||
return &connection{SocketID: socketID, Socket: s}
|
return &connection{SocketID: socketID, Socket: s, CreatedAt: time.Now()}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Publish the message to websocket atached to this client
|
// Publish the message to websocket atached to this client
|
||||||
|
|||||||
Reference in New Issue
Block a user