RocketChat / Rocket.Chat.Java.SDK

[DEPRECATED, NOT MAINTAINED] Java/Android SDK for Rocket.Chat
MIT License
29 stars 23 forks source link

How can i Get Real time Room Msg??? #14

Closed Naguchennai closed 7 years ago

Naguchennai commented 7 years ago

How can i get Real time Message from From a particular Room? only room info? lol I think this is the only important and main part of this sdk.. i missed or u missed?

sacOO7 commented 7 years ago

You need to subscribe to the room in order to get new messages. Code is


        void subscribeMessage(){
            room.subscribeRoomMessageEvent(new SubscribeListener() {
                @Override
                public void onSubscribe(Boolean isSubscribed, String subId) {
                    if (isSubscribed) {
                        System.out.println("subscribed to room successfully");
                    }
                }
            },this);
        }

        @Override
        public void onMessage(String roomId, RocketChatMessage message) {
            System.out.println("will receive new message here");  
        }

Doc is given here https://github.com/RocketChat/Rocket.Chat.Java.SDK/blob/develop/docs/ROCKETCHATDOC.md

I think link to all the docs is given in README file. Read it in total . :+1:

Naguchennai commented 7 years ago

Lol Now only i know about this url https://github.com/RocketChat/Rocket.Chat.Java.SDK/blob/develop/docs/ROCKETCHATDOC.md

Thank you