PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, April 13, 2022

[FIXED] How to listener on realtime firebase database for get data dynamically by backend laravel and websocket ,without use javascript

 April 13, 2022     firebase-realtime-database, laravel, php, phpwebsocket, websocket     No comments   

Issue

I need to get data from firebase realtime database dynamic with out refresh page so, how to do listener on realtime firebase database for get data dynamically by backend laravel and websocket, not from frontend as javascript.

    public function onMessage(ConnectionInterface $conn, $msg)
    {
        echo $msg;
        // $data = json_decode($msg);
        $payload = json_decode($msg);
        if (method_exists($this, $method = 'handle' . ucfirst($payload->event))) {
            $this->{$method}($connection, $payload);
        }

        // if (isset($data->command)) {
        //     // $user = $this->users[$conn->resourceId];

        //     $message = $payload->data;

        // }
    }

Solution

While the Firebase Realtime Database uses web sockets to communicate between the server and its SDKs, this protocol is not documented. The closest you can get with a public API, is to implement Firebase's REST Streaming API.

But you'll have a much easier time if you stick to one of the supported server-side or client-side SDKs. For the server-side such SDKs currently exists for Java, Node.js, Python, and Go.



Answered By - Frank van Puffelen
Answer Checked By - Marilyn (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing