How to connect two random people in a single thread using Laravel Broadcasting












6















I'm creating a random real-time chat, like Omegle.



I'm having trouble to connect two random people in a private thread using a wait list. What would be the best way to do it using Laravel Broadcasting and Laravel Job?



For example:



Route::get('/start', function () {
// add me to the wait list
// wait for another person
// find another person
// remove me and another person from the wait list

// dispatch event
AppEventsAnotherPersonFound::dispatch($anotherPerson, $threadId);
});









share|improve this question




















  • 1





    'Trouble' how, in what way?

    – Ashley Brown
    Oct 7 '18 at 16:35











  • How to configure the routes and events to achieve a random chat?

    – Isaac Ferreira
    Oct 7 '18 at 16:37






  • 2





    So you want a full blown tutorial?

    – Ashley Brown
    Oct 7 '18 at 16:37






  • 1





    I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

    – Ashley Brown
    Oct 7 '18 at 16:41













  • I want to know how to join two random people that are waiting. I just edited my post, check it, please.

    – Isaac Ferreira
    Oct 7 '18 at 16:43
















6















I'm creating a random real-time chat, like Omegle.



I'm having trouble to connect two random people in a private thread using a wait list. What would be the best way to do it using Laravel Broadcasting and Laravel Job?



For example:



Route::get('/start', function () {
// add me to the wait list
// wait for another person
// find another person
// remove me and another person from the wait list

// dispatch event
AppEventsAnotherPersonFound::dispatch($anotherPerson, $threadId);
});









share|improve this question




















  • 1





    'Trouble' how, in what way?

    – Ashley Brown
    Oct 7 '18 at 16:35











  • How to configure the routes and events to achieve a random chat?

    – Isaac Ferreira
    Oct 7 '18 at 16:37






  • 2





    So you want a full blown tutorial?

    – Ashley Brown
    Oct 7 '18 at 16:37






  • 1





    I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

    – Ashley Brown
    Oct 7 '18 at 16:41













  • I want to know how to join two random people that are waiting. I just edited my post, check it, please.

    – Isaac Ferreira
    Oct 7 '18 at 16:43














6












6








6


2






I'm creating a random real-time chat, like Omegle.



I'm having trouble to connect two random people in a private thread using a wait list. What would be the best way to do it using Laravel Broadcasting and Laravel Job?



For example:



Route::get('/start', function () {
// add me to the wait list
// wait for another person
// find another person
// remove me and another person from the wait list

// dispatch event
AppEventsAnotherPersonFound::dispatch($anotherPerson, $threadId);
});









share|improve this question
















I'm creating a random real-time chat, like Omegle.



I'm having trouble to connect two random people in a private thread using a wait list. What would be the best way to do it using Laravel Broadcasting and Laravel Job?



For example:



Route::get('/start', function () {
// add me to the wait list
// wait for another person
// find another person
// remove me and another person from the wait list

// dispatch event
AppEventsAnotherPersonFound::dispatch($anotherPerson, $threadId);
});






php laravel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 9 '18 at 23:32







Isaac Ferreira

















asked Oct 7 '18 at 16:25









Isaac FerreiraIsaac Ferreira

979




979








  • 1





    'Trouble' how, in what way?

    – Ashley Brown
    Oct 7 '18 at 16:35











  • How to configure the routes and events to achieve a random chat?

    – Isaac Ferreira
    Oct 7 '18 at 16:37






  • 2





    So you want a full blown tutorial?

    – Ashley Brown
    Oct 7 '18 at 16:37






  • 1





    I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

    – Ashley Brown
    Oct 7 '18 at 16:41













  • I want to know how to join two random people that are waiting. I just edited my post, check it, please.

    – Isaac Ferreira
    Oct 7 '18 at 16:43














  • 1





    'Trouble' how, in what way?

    – Ashley Brown
    Oct 7 '18 at 16:35











  • How to configure the routes and events to achieve a random chat?

    – Isaac Ferreira
    Oct 7 '18 at 16:37






  • 2





    So you want a full blown tutorial?

    – Ashley Brown
    Oct 7 '18 at 16:37






  • 1





    I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

    – Ashley Brown
    Oct 7 '18 at 16:41













  • I want to know how to join two random people that are waiting. I just edited my post, check it, please.

    – Isaac Ferreira
    Oct 7 '18 at 16:43








1




1





'Trouble' how, in what way?

– Ashley Brown
Oct 7 '18 at 16:35





'Trouble' how, in what way?

– Ashley Brown
Oct 7 '18 at 16:35













How to configure the routes and events to achieve a random chat?

– Isaac Ferreira
Oct 7 '18 at 16:37





How to configure the routes and events to achieve a random chat?

– Isaac Ferreira
Oct 7 '18 at 16:37




2




2





So you want a full blown tutorial?

– Ashley Brown
Oct 7 '18 at 16:37





So you want a full blown tutorial?

– Ashley Brown
Oct 7 '18 at 16:37




1




1





I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

– Ashley Brown
Oct 7 '18 at 16:41







I'm going to flag this to be closed as being too broad because it does seem you're after a guide on how to create a real-time chat within Laravel - to which there are plenty of tutorials if you simply Google searched "real time chat Laravel". Here is such a guide : pusher.com/tutorials/chat-laravel

– Ashley Brown
Oct 7 '18 at 16:41















I want to know how to join two random people that are waiting. I just edited my post, check it, please.

– Isaac Ferreira
Oct 7 '18 at 16:43





I want to know how to join two random people that are waiting. I just edited my post, check it, please.

– Isaac Ferreira
Oct 7 '18 at 16:43












1 Answer
1






active

oldest

votes


















1














I think you can create a channel and associate users with, after the event is dispatched.



See: https://laravel.com/docs/5.7/broadcasting#presence-channels



You can also send a notification about a new match between people by using:



https://laravel.com/docs/5.7/broadcasting#notifications






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52690535%2fhow-to-connect-two-random-people-in-a-single-thread-using-laravel-broadcasting%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    I think you can create a channel and associate users with, after the event is dispatched.



    See: https://laravel.com/docs/5.7/broadcasting#presence-channels



    You can also send a notification about a new match between people by using:



    https://laravel.com/docs/5.7/broadcasting#notifications






    share|improve this answer




























      1














      I think you can create a channel and associate users with, after the event is dispatched.



      See: https://laravel.com/docs/5.7/broadcasting#presence-channels



      You can also send a notification about a new match between people by using:



      https://laravel.com/docs/5.7/broadcasting#notifications






      share|improve this answer


























        1












        1








        1







        I think you can create a channel and associate users with, after the event is dispatched.



        See: https://laravel.com/docs/5.7/broadcasting#presence-channels



        You can also send a notification about a new match between people by using:



        https://laravel.com/docs/5.7/broadcasting#notifications






        share|improve this answer













        I think you can create a channel and associate users with, after the event is dispatched.



        See: https://laravel.com/docs/5.7/broadcasting#presence-channels



        You can also send a notification about a new match between people by using:



        https://laravel.com/docs/5.7/broadcasting#notifications







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 18:52









        loic.lopezloic.lopez

        1941113




        1941113






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52690535%2fhow-to-connect-two-random-people-in-a-single-thread-using-laravel-broadcasting%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]