This repository was archived by the owner on Jul 1, 2021. It is now read-only.
File tree 10 files changed +37
-27
lines changed
10 files changed +37
-27
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ package ws
2
2
3
3
import (
4
4
"bytes"
5
- "github.com/spiral/roadrunner/service/http/attributes"
6
5
"io"
7
6
"net/http"
8
7
"strings"
8
+
9
+ "github.com/spiral/roadrunner/service/http/attributes"
9
10
)
10
11
11
12
type accessValidator struct {
Original file line number Diff line number Diff line change 1
1
package ws
2
2
3
3
import (
4
- "github.com/stretchr/testify/assert"
5
4
"testing"
5
+
6
+ "github.com/stretchr/testify/assert"
6
7
)
7
8
8
9
func TestResponseWrapper_Body (t * testing.T ) {
Original file line number Diff line number Diff line change 1
1
package ws
2
2
3
3
import (
4
+ "strings"
5
+
4
6
"github.com/gorilla/websocket"
5
7
"github.com/sirupsen/logrus"
6
8
"github.com/spf13/cobra"
7
9
ws "github.com/spiral/broadcast-ws"
8
10
rr "github.com/spiral/roadrunner/cmd/rr/cmd"
9
11
"github.com/spiral/roadrunner/cmd/util"
10
- "strings"
11
12
)
12
13
13
14
func init () {
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ package ws
2
2
3
3
import (
4
4
"encoding/json"
5
+ "testing"
6
+
5
7
"github.com/spiral/roadrunner/service"
6
8
"github.com/stretchr/testify/assert"
7
- "testing"
8
9
)
9
10
10
11
type mockCfg struct { cfg string }
Original file line number Diff line number Diff line change @@ -2,8 +2,9 @@ package ws
2
2
3
3
import (
4
4
"encoding/json"
5
+
5
6
"github.com/gorilla/websocket"
6
- "github.com/spiral/broadcast"
7
+ "github.com/spiral/broadcast/v2 "
7
8
)
8
9
9
10
// ConnContext carries information about websocket connection and it's topics.
Original file line number Diff line number Diff line change 1
1
package ws
2
2
3
3
import (
4
- "github.com/stretchr/testify/assert"
5
4
"testing"
5
+
6
+ "github.com/stretchr/testify/assert"
6
7
)
7
8
8
9
func TestConnContext_ManageTopics (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ package ws
2
2
3
3
import (
4
4
"errors"
5
- "github.com/gorilla/websocket"
6
- "github.com/spiral/broadcast"
7
5
"sync"
6
+
7
+ "github.com/gorilla/websocket"
8
+ "github.com/spiral/broadcast/v2"
8
9
)
9
10
10
11
// manages a set of websocket connections
@@ -116,10 +117,11 @@ func (cp *connPool) close() {
116
117
cp .errHandler (err , conn )
117
118
}
118
119
119
- delete (cp .conns , conn )
120
- close (ctx .upstream )
121
120
if err := conn .Close (); err != nil {
122
121
cp .errHandler (err , conn )
123
122
}
123
+
124
+ delete (cp .conns , conn )
125
+ close (ctx .upstream )
124
126
}
125
127
}
Original file line number Diff line number Diff line change 1
1
module github.com/spiral/broadcast-ws
2
2
3
- go 1.12
3
+ go 1.15
4
4
5
5
require (
6
6
github.com/gorilla/websocket v1.4.1
7
- github.com/prometheus/client_golang v1.2.1 // indirect
7
+ github.com/prometheus/client_golang v1.5.0
8
8
github.com/sirupsen/logrus v1.4.2
9
- github.com/spf13/cobra v0.0.5 // indirect
10
- github.com/spiral/broadcast v0 .0.0-20191206140608-766959683e74
11
- github.com/spiral/roadrunner v1.5.2
12
- github.com/stretchr/testify v1.3.0
9
+ github.com/spf13/cobra v0.0.6
10
+ github.com/spiral/broadcast/v2 v2 .0.5-beta1
11
+ github.com/spiral/roadrunner v1.6.4
12
+ github.com/stretchr/testify v1.5.1
13
13
)
Original file line number Diff line number Diff line change @@ -2,14 +2,15 @@ package ws
2
2
3
3
import (
4
4
"encoding/json"
5
+ "net/http"
6
+ "sync"
7
+ "sync/atomic"
8
+
5
9
"github.com/gorilla/websocket"
6
- "github.com/spiral/broadcast"
10
+ "github.com/spiral/broadcast/v2 "
7
11
"github.com/spiral/roadrunner/service/env"
8
12
rhttp "github.com/spiral/roadrunner/service/http"
9
13
"github.com/spiral/roadrunner/service/rpc"
10
- "net/http"
11
- "sync"
12
- "sync/atomic"
13
14
)
14
15
15
16
// ID defines service id.
Original file line number Diff line number Diff line change @@ -2,21 +2,22 @@ package ws
2
2
3
3
import (
4
4
"encoding/json"
5
+ "io/ioutil"
6
+ "net/http"
7
+ "net/url"
8
+ "strings"
9
+ "testing"
10
+ "time"
11
+
5
12
"github.com/gorilla/websocket"
6
13
"github.com/sirupsen/logrus"
7
14
"github.com/sirupsen/logrus/hooks/test"
8
- "github.com/spiral/broadcast"
15
+ "github.com/spiral/broadcast/v2 "
9
16
"github.com/spiral/roadrunner/service"
10
17
"github.com/spiral/roadrunner/service/env"
11
18
rrhttp "github.com/spiral/roadrunner/service/http"
12
19
"github.com/spiral/roadrunner/service/rpc"
13
20
"github.com/stretchr/testify/assert"
14
- "io/ioutil"
15
- "net/http"
16
- "net/url"
17
- "strings"
18
- "testing"
19
- "time"
20
21
)
21
22
22
23
type testCfg struct {
You can’t perform that action at this time.
0 commit comments