chabokpush / chabok-client-rn

Chabok react native wrapper
https://doc.chabokpush.com/react-native-bridge/introducing.html
5 stars 5 forks source link

Connection issue #14

Closed Mr-Hqq closed 5 years ago

Mr-Hqq commented 6 years ago

Hi! When i send my push too my app return connectionStatus Instead message from ChabokMessageReceived event.

Mr-Hqq commented 5 years ago

Please Answer.

amir-yaghoubi commented 5 years ago

Please provide more informations, like in android or ios device, and attach your push payload

Mr-Hqq commented 5 years ago

Its android emulator. and the same data and notification to another app has been sent. and this app don't received notification.

behrad commented 5 years ago

When i send my push too my app return connectionStatus Instead message from ChabokMessageReceived event.

For any team to be able to support and handle questions, there's a need to be provided more information. So please provide a sample code snippet of your usage, or related exception/error message, or more info generally about whats happening. Your question is not clear.

Mr-Hqq commented 5 years ago

This is my usage code

let chabokEmitter = null
const SIZE = 40;
class Home extends Component {
    constructor(props) {
        super(props);
        this.state = {
            isLoading: false,
            activeTab: 'inOrder',
            newWork: false,
            message: {}
        };
        chabokEmitter = new NativeEventEmitter(NativeModules.AdpPushClient);
    }
    componentWillMount() {
        const {auth, work, history} = this.props;
        if (auth.status === true) {
            this.setState({activeTab: 'inOrder'})
        } else {
            this.setState({activeTab: 'outOfOrder'})
        }
        const options = {
            "appId": "---",
            "apiKey": "---",
            "username": "---",
            "password": "---",
            "isDev": true
        };
        const USER = auth.id.toString() + "_repairman";
        this.chabok = new chabok.AdpPushClient();
        this.chabok.initializeApp("chabokdemos", options, (response) => {
            console.log('app initialized', response)
        });
        this.chabok.register(USER, []);
        work.isWork ? history.push('/newRequest'): '';
    }
    componentDidMount() {
        chabokEmitter.addListener(
            'connectionStatus',
            (status) => {
                console.log('connectionStatus', status)
            }
        );
        chabokEmitter.addListener(
            'ChabokMessageReceived',
            (message) => {
                console.log(message)
                this.setState({newWork: true, message: message});
            }
        );
    }

this is image of whats happend when i send push: image

actually when i send push has to received to this callBack:

        chabokEmitter.addListener(
            'ChabokMessageReceived',
            (message) => {
                console.log(message)
                this.setState({newWork: true, message: message});
            }
        );

but below callBack has action:

        chabokEmitter.addListener(
            'connectionStatus',
            (status) => {
                console.log('connectionStatus', status)
            }
        );
behrad commented 5 years ago
  1. Please use correct code formatting tags for your code! [javascript formatter]
  2. Never put your account information inside GITHUB issues

I edited your issue.

Your logs shows that you are getting disconnected when receiving a push.

Check your panel to see why your message is not delivered to that device. And send us an example similar payload of your push