Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I know there are the id rooms? #14

Closed
MrChebik opened this issue Mar 28, 2017 · 6 comments
Closed

How can I know there are the id rooms? #14

MrChebik opened this issue Mar 28, 2017 · 6 comments

Comments

@MrChebik
Copy link

I need to check, if id created this room to join them.

@mslosarz
Copy link
Owner

mslosarz commented Mar 28, 2017

There are two ways to create conversation. You can use join (when conversation wasn't exists then new one will be created), or use create (then you'll receive created signal with room id in signal content). If you want, you can write your own signal which will check if conversation with given name exists (details here)

@MrChebik
Copy link
Author

Thank you for quick reply.

So, I have this: https://pastebin.com/Nm5QyRar
And when I try to run, I get exception:

Invalid factory method 'addCustomJoinHandler': needs to have a non-void return type!

@mslosarz
Copy link
Owner

mslosarz commented Mar 28, 2017

my mistake, return for example signal instead of void then spring context will be able to start.
I fixed documentation :)

@mslosarz
Copy link
Owner

You could autowire org.nextrtc.signalingserver.repository.Conversations. This repository has method Optional findBy(String conversationId). You can use them to check if conversation exists or not

@MrChebik
Copy link
Author

MrChebik commented Mar 28, 2017

Thank you.

But what to do, if I get NullPointerException?

resolver.addCustomHandler(Signal.fromString("join_exist"), (msg) ->
            InternalMessage.create()
                    .to(msg.getFrom())
                    .content(conversations.findBy(msg.getContent()) == null ? msg.getContent() : "NOT_CREATED")
                    .build()
                    .send()
        );

I want to check, if conversation is exist.
I check message and if this not equals NOT_CREATED, I join to this room.

Hmm...
I don't use Signal. Now, I use Signal.EMPTY and this works.

@MrChebik
Copy link
Author

You are the best!
Thank you for this library!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants