Coder Social home page Coder Social logo

latchet's People

Contributors

dcarrith avatar djbryanth avatar elliotlanderson avatar gianlucaguarini avatar jacksierkstra avatar lokielse avatar orthographic-pedant avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

latchet's Issues

Start server?

Hello, I have my website on shared hosting and can't connect to other port then 80, do I need to start server or can I still listen to socket connections?

How to broadcast message from laravel to clients?

  1. I can use javascript to subscribe Latchet topic and broadcast message to all the clients which subscribe the same topic, this is not I want.
  2. I want trigger broadcast from Laravel server side, for example, read the database and broadcast the data to clients who subscribe the specific channel.
  3. I don't want to use Zeromq solution.
    Thanks for reply!

After Reload Browser, Subscribe Push Message is Not Working

Hey @sidneywidmer , thank for your wonderfull package before. I have some question, Push message is working on my first visit on browser.

The trigger publish event is called by RESTFULL

// Trigger to push notification on all client
Router::post('/postsomething', function(){
    Latchet::publish('chat/room/12', array('msg' => 'foo'));
})

Here is my Connection code

<?php

namespace Hunter\Sockets;

use Sidney\Latchet\BaseConnection;
use Hunter\Core\User;

class Connection extends BaseConnection {

    public function open($connection)
    {
        $connection->sockets = new \StdClass;
        $connection->sockets->name  = $connection->WAMP->sessionId;
    }

    public function close($connection)
    {
        $user = $connection->sockets->name;
        echo "connection closed. User: " . $user . " \n";
        $connection->close();
    }

    public function error($connection, $exception)
    {
        //close the connection
        $connection->close();
        echo $exception->getMessage();
        throw new \Exception($exception);
    }
}

ChatTopic

<?php

namespace Hunter\Sockets;

use Sidney\Latchet\BaseTopic;

class ChatTopic extends BaseTopic
{
    public function subscribe($connection, $topic)
    {
        // $connection->sockets->currentRoom = $topic;
        echo $topic."\n";
    }

    public function publish($connection, $topic, $message, array $exclude, array $elligible)
    {
        $this->broadcast($topic, array('msg' => $message ));
    }

    public function call($connection, $id, $topic, array $params)
    {

    }

    public function unsubscribe($connection, $topic)
    {

    }
}

and the events

Latchet::connection('Hunter\Sockets\Connection');
Latchet::topic('chat/room/{roomid}', 'Hunter\Sockets\ChatTopic');
<!DOCTYPE html>
<html lang="en" ng-app="App">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">


  </head>
  <body>

    <!--[if lt IE 10]>
      <p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
    <![endif]-->

    <div class="message-bar"></div>


    <script src="http://autobahn.s3.amazonaws.com/js/autobahn.min.js"></script>
    <script>
      var socket;

      ab.connect('ws://chunterapp.dev:8080',
        function (session) {
          // subscribe is not working after reload browser :(
          session.subscribe('chat/room/12', function (topic, msg) {
            console.log(topic);
          });
        },
        function (code, reason, detail) {
          session = null;
          // alert(reason);
        },
        {

        }
      );

    </script>

  </body>
</html>

My code in the above is working on my first visit on the browser, but when i reload the browser push message on subscribe is not working, until i restart latchet listen.

Thanks for your help.

$request can not be null

I'm missing something here. I'm following along with your docs. When I run the start command "sudo php artisan latchet:listen" and I try to make a websocket connection to the server ('ws://localhost:1111') the instance shuts down and echos out
[UnexpectedValueException]
$request can not be null

I used artisan to generate the files and then went to test when I received this error.

wss?

I have successfully installed and configured everything for this package, just to reach the point that I learned that websocket protocol must be wss over https connections. how can I configure this package to behave as WSS entry point?

Are the channels protected?

Hi,

I have the next question - how is it possible to allow the connections to the channels only for the 1. authorized customers AND 2. only for certain customer.

E.g. I want to establish the private websocket connection with the customer with id 3 and I want to send the notifications through that channel.

Considering, that I want to be sure, that any other customer or hacker would not be able to connect to that channel. How this could be done with Latchet? Is there any concept to cover this?

Thanks

Add notice about Autobahn|JS 0.9 to readme

After some frustrating hours I found out that Autobahn|JS 0.9 is not supported by Ratchet. You have to use Version 0.8. Maybe you should add a note to the documentation.

Latchet is not stable. bad performance. sad ;(

I used Latchet in production for a half month. It's seems like not very stable for many(about 50%) messages can't get arrived at client from server.

I don't konw how to debug with the issue. It's result of zmq or latchet or ratchet? I don't konw.

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.