All pages
Powered by GitBook
1 of 15

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Methods

All the methods associated with the socket channels

leavePhoenixChannelleavePhoenixChannelEventsleavePhoenixChannelEventgetPhoenixChannelpushPhoenixChannel

Events

All the events associated with the socket channels

CHANNEL_ERRORCHANNEL_LEAVECHANNEL_JOIN_ERRORCHANNEL_JOINCHANNEL_TIMEOUTCHANNEL_PUSH_ERRORCHANNEL_CLOSE

CHANNEL_LEAVE

After phoenix channel is left. The following redux event is dispatched

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_LEAVE } = channelActionTypes;
Parameter
Description

type

CHANNEL_LEAVE

channel

Phoenix channel

CHANNEL_JOIN

After joining a phoenix channel, the following redux event is dispatched.

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_JOIN } = channelActionTypes;
Parameter
Description

type

CHANNEL_JOIN

channel

Phoenix channel

additionalData

additionalData passed when using

response

Phoenix channel response

getPhoenixChannel

CHANNEL_CLOSE

Should a phoenix channel be explicitly closed on the server or the channel was explicitly closed by calling channel.leave(). The following redux event is dispatched

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_CLOSE } = channelActionTypes;
Parameter
Description

type

CHANNEL_CLOSE

channel

Phoenix channel

CHANNEL_TIMEOUT

Should an error occur from the phoenix socket channel, the following redux event is dispatched. Timeout error response after joining the phoenix channel.

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_TIMEOUT } = channelActionTypes;
Parameter
Description

type

CHANNEL_TIMEOUT

channelTopic

Name of channel/Topic

channel

Phoenix channel

additionalData

additionalData passed when using getPhoenixChannel

error

Phoenix channel error

leavePhoenixChannelEvent

This method will unsubscribe for the given event for the given channelTopic

import { leavePhoenixChannelEvent } from '@trixtateam/phoenix-to-redux';

Parameters

Parameter
Description
Type
Required

channelTopic

Name of channel/Topic

string

event

Event name to unsubscribe to

string

Channel

All the methods and events associated with the socket channels

MethodsEvents

CHANNEL_ERROR

Should an error occur from the phoenix socket channel, the following redux event is dispatched. Invoked if the socket connection drops, or the channel crashes on the server.

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_ERROR } = channelActionTypes;
Parameter
Description

type

CHANNEL_ERROR

channelTopic

Name of channel/Topic

channel

Phoenix channel

leavePhoenixChannelEvents

This method will unsubscribe for the given events for the given channelTopic

import { leavePhoenixChannelEvents } from '@trixtateam/phoenix-to-redux';

Parameters

Parameter
Description
Type
Required

channelTopic

Name of channel/Topic

string

events

Array of event names to unsubscribe to

string []

CHANNEL_JOIN_ERROR

Should an error occur from the phoenix socket channel, the following redux event is dispatched. Error response after joining the phoenix channel.

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_JOIN_ERROR } = channelActionTypes;
Parameter
Description

type

CHANNEL_JOIN_ERROR

channelTopic

Name of channel/Topic

channel

Phoenix channel

additionalData

additionalData passed when using getPhoenixChannel

error

Phoenix channel error

leavePhoenixChannel

This method will leave the phoenix channel for the given channelTopic and unsubscribes off of channel events

import { leavePhoenixChannel } from '@trixtateam/phoenix-to-redux';

Parameters

Parameter
Description
Type
Required

channelTopic

Name of channel/Topic

string

getPhoenixChannel

This method will subscribe phoenix channel for the given channelTopic and given events

import { getPhoenixChannel } from '@trixtateam/phoenix-to-redux';

Recommended that you already have made a socket connection by using connectPhoenix method before using this method.

Parameters

Parameter
Description
Type
Required

events

Array of event names to subscribe to and will dispatch response to eventActionType

{

eventName:string; eventActionType:string

} []

domainUrl

socket endpoint to connect to

string

channelTopic

Name of channel/Topic

string

logPresence

Determines if presence should be tracked for the channel

boolean

token

private token for channel

string

additionalData

This data will be available for you as additionalData on the response

object

pushPhoenixChannel

This method will attempt to find the subscribed phoenix channel for the given channelTopic and push data to the channel for the eventName.

import { pushPhoenixChannel } from '@trixtateam/phoenix-to-redux';

Recommended that you already have made a socket connection by using connectPhoenix method before using this method.

Parameters

Parameter
Description
Type
Required

additionalData

This data will be available for you as additionalData on the response

object

loadingStatusKey

A unique identifier you can use to separate progress status

string

endProgressDelay

timeout in milliseconds if you want to delay the endProgress of your loadingStatusKey

number

channelResponseEvent

name of redux event to dispatch to reducer on response from pushing to channel

string

channelErrorResponseEvent

name of redux event to dispatch to reducer on error from pushing to channel

string

channelTimeOutEvent

name of redux event to dispatch to reducer on timeout from pushing to channel

string

dispatchChannelError

false by default, determines if should an on channel error occur dispatch to the reducer

boolean

channelPushTimeOut

timeout in milliseconds for pushing to the channel, default is 1500

number

channelTopic

Name of channel/Topic

string

eventName

Name of the event on channel to push to

string

requestData

Payload data to push on the channel

any

PHOENIX_CHANNEL_ERROR

CHANNEL_PUSH_ERROR

Should an error occur from the phoenix socket channel, the following redux event is dispatched. Error response after pushing data to phoenix channel.

import { channelActionTypes } from '@trixtateam/phoenix-to-redux';
const { CHANNEL_PUSH_ERROR } = channelActionTypes;
Parameter
Description

type

CHANNEL_PUSH_ERROR

channelTopic

Name of channel/Topic

channel

Phoenix channel

error

Phoenix channel error