Skip to content

Commit

Permalink
Merge ad4c80a into cd6986d
Browse files Browse the repository at this point in the history
  • Loading branch information
dombenson committed Mar 4, 2020
2 parents cd6986d + ad4c80a commit beeb4e7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
14 changes: 14 additions & 0 deletions sockjs/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,20 @@ func (s *session) Send(msg string) error {
return s.sendMessage(msg)
}

func (s *session) ReceiverType() string {
if s.recv != nil {
switch s.recv.(type) {
case *wsReceiver:
return "Websocket"
case *rawWsReceiver:
return "Raw Websocket"
case *httpReceiver:
return "HTTP Fallback"
}
}
return "None"
}

func (s *session) ID() string { return s.id }

func (s *session) GetSessionState() SessionState {
Expand Down
2 changes: 2 additions & 0 deletions sockjs/sockjs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import "net/http"
type Session interface {
// Id returns a session id
ID() string
// ReceiverType returns the connection handler type
ReceiverType() string
// Request returns the first http request
Request() *http.Request
// Recv reads one text frame from session
Expand Down

0 comments on commit beeb4e7

Please sign in to comment.