Git Product home page Git Product logo

Comments (12)

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

Hey @hongsa ,

Can you share a bit more code on how you have initialized client and created the channel? That will help us with debugging.

from stream-chat-react-native.

hongsa avatar hongsa commented on June 8, 2024
const channelId = `${targetClazz.id}-${teacher.id}-${parent.id}`;
    const conversation = await chatClient.channel('messaging', channelId, {
      name: `${teacher.name} / ${parent.name}`,
      image: targetClazz.profile_image,
      members: [userInfo.id, receiver.id],
      clazz: {
        name: targetClazz.name,
        profile_image: targetClazz.profile_image,
      },
    });`
await conversation.watch();

Only watch channel.
Anything I have to do??

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

Hey @hongsa ,

I tried testing the app/sdk on our side with given version of RN and stream-chat-react-native, and it seems to be working fine. It's quite hard to say whats going wrong here

But we have some debug/logging capabilities on JS client.

When you initialize the client, please pass the logger function as part of options object (3rd parameter):
e.g.,

const chatClient = new StreamChat('qk4nn7rpcn75', null, {
  logger: (type, msg) => {
    console.log(msg);
  }
});

This shall log all the activities in js client. Please check this for more details about logger function. - https://github.com/GetStream/stream-chat-js/blob/master/src/client.js#L106

You can enable remote debugger and fetch the logs in console of browser. If you can paste those logs here, that would be great. That will help us to check if something is failing for your case.

Note Make sure to send a message on channel to get the logs of those events as well.

from stream-chat-react-native.

hongsa avatar hongsa commented on June 8, 2024

@vishalnarkhede

sender
스크린샷 2019-08-13 오후 10 37 04

receiver
스크린샷 2019-08-13 오후 10 37 11

"stream-chat-react-native": "^0.1.17",
"react": "16.8.3",
"react-native": "0.59.10"

And also remove netinfo because of this library.

Channel list's realtime works well.
But chatting is still not working.
When i was out and re inside to the room, it refresh. But it is not real time.

Please help me.

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

@hongsa

Thanks. Ok so from the logs I can see that, you are receiving the message.newevent. So there is no issue with watching the channel.

Is it possible for you to paste entire piece of code (related to stream ... you can leave api_key and secret keys blank) here or send us via email?

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

Hey @hongsa ,

Did you remove the code?

from stream-chat-react-native.

hongsa avatar hongsa commented on June 8, 2024

I sent you by email!

from stream-chat-react-native.

hongsa avatar hongsa commented on June 8, 2024

Re send

import React, { Component } from 'react';
import { View, SafeAreaView } from 'react-native';
import PropTypes from 'prop-types';
import {
  Chat,
  Channel,
  MessageList,
  MessageInput,
} from 'stream-chat-react-native';
import { Navigation } from 'react-native-navigation';

import { chatClient } from '~/utills/stream';
import { popScreen } from '~/utills/router';

const theme = {
  colors: {
    primary: '#00c896',
  },
};

class ChatConversationContainer extends Component {
  constructor(props) {
    super(props);
    Navigation.events().bindComponent(this);
  }

  componentDidMount() {
    Navigation.mergeOptions(this.props.componentId, {
      topBar: {
        leftButtons: [{
          id: 'close',
          icon: require('~/assets/navigation/ic_arrow_back.png'),
        }],
      },
    });
  }

  async navigationButtonPressed({ buttonId }) {
    if (buttonId === 'close') {
      const { navigatorProps: { isCreate = false, chatListComponentId }, componentId } = this.props;
      if (isCreate) {
        Navigation.popTo(chatListComponentId);
      }
      popScreen({ componentId });
    }
  }

  render() {
    const { navigatorProps: { channel } } = this.props;
    return (
      <SafeAreaView>
        <Chat
          style={theme}
          client={chatClient}
        >
          <Channel
            client={chatClient}
            channel={channel}
          >
            <View style={{ display: 'flex', height: '100%' }}>
              <MessageList />
              <MessageInput />
            </View>
          </Channel>
        </Chat>
      </SafeAreaView>
    );
  }
}

ChatConversationContainer.propTypes = {
  componentId: PropTypes.string.isRequired,
  navigatorProps: PropTypes.shape({
    channel: PropTypes.object.isRequired,
    isCreate: PropTypes.bool,
    chatListComponentId: PropTypes.object,
  }).isRequired,
};

export default ChatConversationContainer;

from stream-chat-react-native.

hongsa avatar hongsa commented on June 8, 2024

I solve this problem...
In chat screen, I need to get channel again by query!!!

Why example is give to params??
This is not working in real time.

Please update your example

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

Hey @hongsa

You shouldn't need to query the channel again actually. I have a suspicion that something is going wrong when you pass the channel via param to Channel screen. In our examples we use react-navigation (which still works). But in your case, you are using react-native-navigation.

I tried to do the setup for react-native-navigation library in our app example, just to test it out. But I am having some issues

I will update you once I manage to set it up and test your use case !! But great to hear that you have found a workaround for now :)

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

@hongsa So I managed to setup the example with react-native-navigation and reproduced the issue about real time. As it turns out, when props are passed as parameters, they get totally modified. All the immutables properties and ws connections are disturbed. So yeah ... for now you will have to query the channels when u open channel screen. This is not the case for react-navigation though.

from stream-chat-react-native.

vishalnarkhede avatar vishalnarkhede commented on June 8, 2024

Closing this issue for now. Solution would be to just pass channel id via params and then query the channel corresponding to channel id on channel screen.

from stream-chat-react-native.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.