Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React本机自定义主机推送器连接_Reactjs_React Native_Pusher_Pusher Js - Fatal编程技术网

Reactjs React本机自定义主机推送器连接

Reactjs React本机自定义主机推送器连接,reactjs,react-native,pusher,pusher-js,Reactjs,React Native,Pusher,Pusher Js,似乎无法连接到推进器。我已经在这里工作了好几天了,似乎无法和普什取得联系。版本6.0.3 import Pusher from 'pusher-js/react-native'; componentDidMount() { this.willFocusSubscription = this.props.navigation.addListener( 'willFocus', () => { try {

似乎无法连接到推进器。我已经在这里工作了好几天了,似乎无法和普什取得联系。版本6.0.3

 import Pusher from 'pusher-js/react-native';

componentDidMount() {
    this.willFocusSubscription = this.props.navigation.addListener(
        'willFocus',
        () => {

            try {
                this.pusher = new Pusher('key', {
                    wsHost: 'host',
                    wsPort: 6001,
                    enabledTransports: ['ws'],
                    disableStats:true,
                });
                Pusher.log = (msg) => {
                    console.log('Pusher message ' + msg);
                };
            } catch (error) {
                console.log('error', error)
            }

            this.group_channel = this.pusher.subscribe('groupchat.' + session_id);
            this.pusher.connection.bind('GroupMessageSent', (data) => {
                console.log('connected', data)
            });
            this.group_channel.bind('GroupMessageSent', (data) => {
                console.log('data', data)
            });


        })
}
推送器消息推送器::[“连接”,“传输”:“xhr_轮询”,“url”:“}]

我已经检查过推送器在本地主机上对我来说工作正常 我认为主要原因是您的ws
ws://test.dockoto.com:6001
如您所知,Laravel WebSockets默认端口
6001
,但仍需要打开服务器上的端口

共享托管我认为如果需要,您必须与托管提供商联系以打开端口

EC2:

你是说。您已在本地主机中连接到ws://test.dockoto.com:6001?没有我自己的推送程序设置这是设置推送程序所需的全部,对吗?只是确保我没有忘记任何设置。