File tree Expand file tree Collapse file tree 1 file changed +19
-18
lines changed
packages/core/realtime-js/src Expand file tree Collapse file tree 1 file changed +19
-18
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ export default class RealtimeChannel {
19
19
public params : { [ key : string ] : any } = { } ,
20
20
public socket : RealtimeClient
21
21
) {
22
+ this . params = {
23
+ ...{ broadcast : { ack : false , self : false } , presence : { key : '' } } ,
24
+ ...params ,
25
+ }
22
26
this . timeout = this . socket . timeout
23
27
this . joinPush = new Push (
24
28
this ,
@@ -95,24 +99,21 @@ export default class RealtimeChannel {
95
99
if ( this . joinedOnce ) {
96
100
throw `tried to subscribe multiple times. 'subscribe' can only be called a single time per channel instance`
97
101
} else {
98
- const configs = this . bindings . reduce (
99
- ( acc , binding : { [ key : string ] : any } ) => {
100
- const { type } = binding
101
- if (
102
- ! [
103
- 'phx_close' ,
104
- 'phx_error' ,
105
- 'phx_reply' ,
106
- 'presence_diff' ,
107
- 'presence_state' ,
108
- ] . includes ( type )
109
- ) {
110
- acc [ type ] = binding
111
- }
112
- return acc
113
- } ,
114
- { }
115
- )
102
+ const { broadcast, presence } = this . params
103
+ const configs = {
104
+ broadcast,
105
+ presence,
106
+ realtime : [ ] ,
107
+ }
108
+
109
+ this . bindings . reduce ( ( acc , binding ) => {
110
+ const { type } = binding
111
+ if ( type === 'realtime' ) {
112
+ acc [ type ] = acc [ type ] . push ( binding )
113
+ }
114
+
115
+ return acc
116
+ } , configs )
116
117
117
118
this . updateJoinPayload ( { configs } )
118
119
You can’t perform that action at this time.
0 commit comments