Giter Club home page Giter Club logo

nova-notification-feed's Introduction

Nova Notification Feed

Latest Version on Packagist Quality Score Total Downloads

A Laravel Nova package that adds a notification feed in your Nova app and uses Laravel Echo and websockets to receive and broadcast notifications.

Installation

You can install the package into a Laravel app that uses Nova via composer:

composer require coreproc/nova-notification-feed

This package makes use of Laravel's database notification feature and Nova Echo to receive and broadcast notifications.

By using Nova Echo, we have a readily configured Laravel Echo instance in our JS.

Here are the suggested options for broadcasting/receiving using websockets:

Make sure that you already have any of these options set up and prepare your Laravel project to use it for broadcasting notifications.

You can find instructions about broadcasting in Laravel using the official documentation.

Follow the docs, make sure to run the following to get the notifications table if you have not done so already:

php artisan notifications:table

php artisan migrate

Before broadcasting any events, you will first need to register the App\Providers\BroadcastServiceProvider. In fresh Laravel applications, you only need to uncomment this provider in the providers array of your config/app.php configuration file. This provider will allow you to register the broadcast authorization routes and callbacks.

Make sure that you configure the correct environment variables in your .env file:

BROADCAST_DRIVER=pusher

PUSHER_APP_ID=xxxxxxx
PUSHER_APP_KEY=xxxxxxx
PUSHER_APP_SECRET=xxxxxx
PUSHER_APP_CLUSTER=xxx

You will also need to ensure that you have added an authorization broadcast route in routes/channels.php:

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int)$user->id === (int)$id;
});

Receiving notifications will depend on your User model having the Notifiable trait. You can add the receivesBroadcastNotificationsOn to use a different channel name instead of the user model's namespace.

class User extends Authenticatable
{
    use Notifiable;

    ...

    /**
     * The channels the user receives notification broadcasts on.
     *
     * @return string
     */
    public function receivesBroadcastNotificationsOn()
    {
        return 'users.' . $this->id;
    }
}

Finally, once you have ensured that this is set up, you will also need to override Nova's layout.blade.php. Create a layout file in resources/views/vendor/nova/layout.blade.php and copy the contents from vendor/laravel/nova/resources/views/layout.blade.php.

Add these two lines to the layout template:

// file: resources/views/vendor/nova/layout.blade.php

<!DOCTYPE html>
<html lang="en" class="h-full font-sans antialiased">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=1280">
  <meta name="csrf-token" content="{{ csrf_token() }}">

  @include('nova-echo::meta') <!-- INCLUDE THIS LINE HERE -->

  <title>

  ...

  <dropdown class="ml-auto h-9 flex items-center dropdown-right">
    @include('nova::partials.user')
  </dropdown>

  @include('nova_notification_feed::notification_feed') <!-- AND THIS LINE HERE -->

  ...

You should now be able to see the notification bell on the top right of your Nova UI.

Usage

To broadcast notifications to your notification feed in the Nova app, you can make a notification class that sends notifications via database and broadcast. Here is an example notification class:

use Coreproc\NovaNotificationFeed\Notifications\NovaBroadcastMessage;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\BroadcastMessage;
use Illuminate\Notifications\Notification;

class TestNotification extends Notification
{
    use Queueable;

    protected $level = 'info';
    protected $message = '';

    /**
     * Create a new notification instance.
     *
     * @param $level
     * @param $message
     */
    public function __construct($level, $message = 'Test message')
    {
        $this->level = $level;
        $this->message = $message;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param  mixed $notifiable
     * @return array
     */
    public function via($notifiable)
    {
        return [
            'database',
            'broadcast',
        ];
    }

    /**
     * Get the array representation of the notification.
     *
     * @param  mixed $notifiable
     * @return array
     */
    public function toArray($notifiable)
    {
        return [
            'level' => $this->level,
            'message' => $this->message,
            'url' => 'https://coreproc.com',
            'target' => '_self'
        ];
    }

    /**
     * Get the broadcastable representation of the notification.
     *
     * @param  mixed $notifiable
     * @return BroadcastMessage
     */
    public function toBroadcast($notifiable)
    {
        return new NovaBroadcastMessage($this->toArray($notifiable));
    }
}

Nova Notification Feed relies on having three variables passed in the toArray() method of the notification class: level, message, and url, and an optional target (default: '_blank').

Additionally, you can use the NovaBroadcastMessage class in the toBroadcast() method to ensure that the format of the broadcast can be read by the frontend.

Roadmap

  • Differentiate background color of a new notification
  • Check if the URL is an JSON representation of a route { name: 'index', params: {} }
  • Better design?

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security-related issues, please email [email protected] instead of using the issue tracker.

Credits

About CoreProc

CoreProc is a software development company that provides software development services to startups, digital/ad agencies, and enterprises.

Learn more about us on our website.

License

The MIT License (MIT). Please see License File for more information.

nova-notification-feed's People

Contributors

4n70w4 avatar chrisbjr avatar dependabot[bot] avatar henriquespin avatar naoray avatar spekulatius 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

nova-notification-feed's Issues

Notification shows 'invalid date'

..only on broadcasted notifications. Notifications which were already broadcasted before page load display just fine. (see screenshot)
notification-feed

Seems like it's an issue with the NovaBroadcastMessage

Url Parameter

Thanks in advance !

I see URL parameter in docs, but i check source code and you don't use it.

You implement soon ? can i make a PR ?

Thanks!

'url' => 'https://coreproc.com',

Language

Can you add the language change option? I mean the word "Close" and the language at "moment js" which can be changed using the lang () function.

Don't work for guest (null) users

Hi! I use https://github.com/jrseliga/pseudo for able guest users with null id.

But don't work send notifications to guest users:

Illuminate/Database/QueryException with message 'SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'notifiable_id' cannot be null (SQL: insert into `notifications` (`id`, `type`, `data`, `read_at`, `notifiable_id`, `notifiable_type`, `updated_at`, `created_at`) values (28d892ed-dfcf-4603-aeb2-ab9fa35c93b9, App/Notifications/TestNotification, {"level":"info","message":"Test message","url":"https:////coreproc.com","target":"_self"}, ?, ?, Pseudo/Auth/Guest, 2021-01-11 09:01:13, 2021-01-11 09:01:13))'

I manually alter table and change to nullable. Message saved to table but realtime pushes don't work.

Cannot Install cause dependency

currently im using ""pusher/pusher-php-server": "^4.0",
when trying to install it give errors:

  • Installation request for pusher/pusher-php-server (locked at v4.1.1, required as ^4.0) -> satisfiable by pusher/pusher-php-server[v4.1.1].
    • coreproc/nova-notification-feed 1.3.0 requires pusher/pusher-php-server ^3.2 -> satisfiable by pusher/pusher-php-server[3.4.x-dev].
    • coreproc/nova-notification-feed 1.3.1 requires pusher/pusher-php-server ^3.2 -> satisfiable by pusher/pusher-php-server[3.4.x-dev].
    • Conclusion: don't install pusher/pusher-php-server 3.4.x-dev
    • Installation request for coreproc/nova-notification-feed ^1.3 -> satisfiable by coreproc/nova-notification-feed[1.3.0, 1.3.1].

Dropdown missing

Latest version of Nova, following the instructions and added the required includes in the new layout.blade.php file and the dropdown doesn't appear?

Tried clearing cache and views.

Echo is working as it's displayed in console.

broadcasting/auth 403 error

Hi! I do everything according to the instructions, but the real-time event reception does not work. Events come only during the reloading of the page.

I found one defect. Need use:

Broadcast::channel('users.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

Instead from instruction:

Broadcast::channel('App.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

403 error is fixed.

But in real time no messages are received.
There are no errors in the browser console and server logs.
Any idea what could be wrong?

Nova 2.0.6

Illuminate\Broadcasting\BroadcastException: 404 NOT FOUND

$u = User::find(1);
$u->notify(new \App\Notifications\TestNotification('info'));
   Illuminate\Broadcasting\BroadcastException  : 404 NOT FOUND

  at /var/www/app/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:119
    115|             || $response === true) {
    116|             return;
    117|         }
    118|
  > 119|         throw new BroadcastException(
    120|             is_bool($response) ? 'Failed to connect to Pusher.' : $response['body']
    121|         );
    122|     }
    123|

  Exception trace:

  1   Illuminate\Broadcasting\Broadcasters\PusherBroadcaster::broadcast("Illuminate\Notifications\Events\BroadcastNotificationCreated", ["a7446b6b-b92e-4b8a-6a1f-2391fc7daee1", "App\Notifications\TestNotification"])
      /var/www/app/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php:48

  2   Illuminate\Broadcasting\BroadcastEvent::handle(Object(Illuminate\Broadcasting\Broadcasters\PusherBroadcaster))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

  3   call_user_func_array()
      /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32

  4   Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
      /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:90

  5   Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:34

  6   Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
      /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php:576

  7   Illuminate\Container\Container::call()
      /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:94

  8   Illuminate\Bus\Dispatcher::Illuminate\Bus\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128

  9   Illuminate\Pipeline\Pipeline::Illuminate\Pipeline\{closure}(Object(Illuminate\Broadcasting\BroadcastEvent))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104

  10  Illuminate\Pipeline\Pipeline::then(Object(Closure))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php:98

  11  Illuminate\Bus\Dispatcher::dispatchNow(Object(Illuminate\Broadcasting\BroadcastEvent))
      /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php:49

  12  Illuminate\Queue\CallQueuedHandler::call(Object(Illuminate\Queue\Jobs\SyncJob), ["Illuminate\Broadcasting\BroadcastEvent", "O:38:"Illuminate\Broadcasting\BroadcastEvent":7:{s:5:"event";O:60:"Illuminate\Notifications\Events\BroadcastNotificationCreated":9:{s:10:"notifiable";O:45:"Illuminate\Contracts\Database\ModelIdentifier":4:{s:5:"class";s:8:"App\User";s:2:"id";i:1;s:9:"relations";a:0:{}s:10:"connection";s:5:"mysql";}s:12:"notification";O:34:"App\Notifications\TestNotification":10:{s:8:"\*\level";s:4:"info";s:10:"\*\message";s:12:"Test message";s:2:"id";s:36:"a7446b6b-b92e-4b8a-6a1f-2391fc7daee1";s:6:"locale";N;s:10:"connection";N;s:5:"queue";N;s:15:"chainConnection";N;s:10:"chainQueue";N;s:5:"delay";N;s:7:"chained";a:0:{}}s:4:"data";a:3:{s:4:"data";a:3:{s:5:"level";s:4:"info";s:7:"message";s:12:"Test message";s:3:"url";s:20:"https://coreproc.com";}s:7:"read_at";N;s:10:"created_at";a:2:{s:4:"date";s:19:"2019-06-25 08:32:45";s:8:"timezone";s:3:"UTC";}}s:10:"connection";N;s:5:"queue";N;s:15:"chainConnection";N;s:10:"chainQueue";N;s:5:"delay";N;s:7:"chained";a:0:{}}s:10:"connection";N;s:5:"queue";N;s:15:"chainConnection";N;s:10:"chainQueue";N;s:5:"delay";N;s:7:"chained";a:0:{}}"])
      /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:88

But example code from Pusher work ok!

<?php
  require __DIR__ . '/vendor/autoload.php';

  $options = array(
    'cluster' => 'eu',
    'useTLS' => true
  );
  $pusher = new Pusher\Pusher(
    '.......',
    '.......',
    '.......',
    $options
  );

  $data['message'] = 'hello world';
  $pusher->trigger('my-channel', 'my-event', $data);

Cannot read property 'complete' of undefined

I am using this pkg in combination with laravel-websockets. The configuration of the laravel-websockets seems to work, since I can use the DebugDashboard and connect to my websocket server just fine. However, everytime I open any nova page I get the following error:

image

I am not sure if it might be that my channel is not setup the right way?

// routes/channel.php
Broadcast::channel('MShule.Models.User.{id}', function ($user, $id) {
    return (int) $user->id === (int) $id;
});

// MShule\Models\User
    public function receivesBroadcastNotificationsOn()
    {
        return 'MShule.Models.User.{id}';
    }

Would be super nice if you can give me some hints on where I can look to get rid of this error @chrisbjr ?!

Cannot read property 'privateChannel' of undefined

Hi,

I'm trying to implement your plugin in nova 3.8.2 / Laravel 7.22.4 / PHP 7.4.3

I get 3 JS errors:

nova-echo:1 Uncaught TypeError: Cannot read property 'privateChannel' of undefined
    at t.value (nova-echo:1)
    at Object.<anonymous> (nova-echo:1)
    at n (nova-echo:1)
    at Object.<anonymous> (nova-echo:1)
    at n (nova-echo:1)
    at nova-echo:1
    at nova-echo:1
value @ nova-echo:1
(anonymous) @ nova-echo:1
n @ nova-echo:1
(anonymous) @ nova-echo:1
n @ nova-echo:1
(anonymous) @ nova-echo:1
(anonymous) @ nova-echo:1

vendor.js?id=911c9c048b8f4c9bbb3b:1 TypeError: Cannot read property 'notification' of undefined
    at a.listenForNotifications (nova-notifications:1)
    at a.created (nova-notifications:1)
    at It (vendor.js?id=911c9c048b8f4c9bbb3b:1)
    at en (vendor.js?id=911c9c048b8f4c9bbb3b:1)
    at a.wn._init (vendor.js?id=911c9c048b8f4c9bbb3b:1)
    at new a (vendor.js?id=911c9c048b8f4c9bbb3b:1)
    at vendor.js?id=911c9c048b8f4c9bbb3b:1
    at init (vendor.js?id=911c9c048b8f4c9bbb3b:1)
    at vendor.js?id=911c9c048b8f4c9bbb3b:1
    at d (vendor.js?id=911c9c048b8f4c9bbb3b:1)
Xt @ vendor.js?id=911c9c048b8f4c9bbb3b:1
Ft @ vendor.js?id=911c9c048b8f4c9bbb3b:1
Ht @ vendor.js?id=911c9c048b8f4c9bbb3b:1
It @ vendor.js?id=911c9c048b8f4c9bbb3b:1
en @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn._init @ vendor.js?id=911c9c048b8f4c9bbb3b:1
a @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
init @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
t._update @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn.before @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn.get @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn.$mount @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn.$mount @ vendor.js?id=911c9c048b8f4c9bbb3b:1
init @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
h @ vendor.js?id=911c9c048b8f4c9bbb3b:1
d @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
t._update @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn.before @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn.get @ vendor.js?id=911c9c048b8f4c9bbb3b:1
hn @ vendor.js?id=911c9c048b8f4c9bbb3b:1
(anonymous) @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn.$mount @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn.$mount @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn._init @ vendor.js?id=911c9c048b8f4c9bbb3b:1
wn @ vendor.js?id=911c9c048b8f4c9bbb3b:1
value @ app.js?id=7f4a6e6e19c910740f80:1
(anonymous) @ users:402
Show 16 more frames

nova-echo:1 Uncaught (in promise) TypeError: Cannot read property 'socketId' of undefined
    at t.value (nova-echo:1)
    at nova-echo:1

Here are the steps I did to install it:

  1. Followed Broadcasting doc:
  • checked the csrf_token is present in layout.blade.php
  • composer require pusher/pusher-php-server "~4.0"
  • npm install --save laravel-echo pusher-js
  • checked App\Providers\BroadcastServiceProvider::class, in config/app.php
  • added code in resources/js/bootstrap.js
import Echo from "laravel-echo";

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: 'mycompany-development'
});

Note: in doc, name says; your-pusher-channels-key. I don't know why channels is plural, maybe I am misusing this field

  1. Installed nova-echo:
  • composer require coreproc/nova-echo
  • added @include('nova-echo::meta') <!-- Include this line --> into published vendor/laravel/nova/resources/views/layout.blade.php
  • checked code is : routes/channels.php. I didn't change it

Note: I'm not sure about receivesBroadcastNotificationsOn(), I tried to let it by default, or changing the name to the channel name, but it didn't work in both case

  1. Installing composer require coreproc/nova-notification-feed
  • Already using notifications, so skip migrations
  • created pusher account - channel name is mycompany-development
  • Added pusher variables to .env
PUSHER_APP_KEY=**
PUSHER_APP_SECRET=**
PUSHER_APP_ID=**
PUSHER_APP_CLUSTER=eu
  • include in blade @include('nova_notification_feed::notification_feed') <!-- AND THIS LINE HERE -->
  • I can see the bell
  • copy paste the test notification
  • trigger a notif with: auth()->user()->notify(new \App\Notifications\TestNotification("info", "message"));

Finally, as I changed JS code, I run npm run watch to be sure to have latest JS.

When I remove the bell partials, I still have one warning:

Cannot read property 'privateChannel' of undefined but the other 2 disappear

I think I followed pretty much the docs, is there something you're seeing I'm doing wrong ?

Don't work with Octane

notification feed does not appear when serve project using Laravel/Octane with RoadRunner

Support for laravel-websockets

Hi

Great package, been trying to get it working with laravel-websockets. It seems that there is only a minor change needed to make it work.

It needs to point to another websockets server, normally on port 6001 and then there is some auth routes also included with the package for laravel. The echo client seems to support changing of these variables so you can connect to your own websockets server without Pusher :)

I am having trouble because i have to copy the vue components and change them and reimport them. Would be really nice if you could make the vue components publishable so i don't have to have my own ๐Ÿ‘

Any assistance would be greatly appreciated! Have a nice day

How to use without pusher?

I can use this without broadcast, and just rely on database, but I see errors in the console how do I remove those errors?

TypeError: Cannot read property 'notification' of undefined

[Feature Request] Display url value

In your example on the readme it's shown how an url param is added to the array for the NovaBroadcastMessage. However, this param is never used in the frontend... Would you mind showing it on the frontend if it's filled and hiding it if it's empty?

Poor overlay

Hi! I use Blockly field. Its scrollbars draws over nova-notification-feed div. May be z-index problem, may be not, i don't know.

image

{"event":"pusher:error","data":{"code":4005,"message":"Path not found"}}

In Chrome Dev Tools I see Request:

General:

Request URL: wss://ws-mt1.pusher.com/app/?protocol=7&client=js&version=4.3.1&flash=false
Request Method: GET
Status Code: 101 Switching Protocols

Response headers:

Connection: Upgrade
Sec-WebSocket-Accept: o+LmAza9rXmxIk4YBjScTYCAQgo=
Upgrade: websocket

Request headers:

Accept-Encoding: gzip, deflate, br
Accept-Language: ru-RU,ru;q=0.9,en-US;q=0.8,en;q=0.7
Cache-Control: no-cache
Connection: Upgrade
Host: ws-mt1.pusher.com
Origin: http://192.168.88.214:800
Pragma: no-cache
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Sec-WebSocket-Key: 9Y9SRJGDeN3Tyc9k+yf07g==
Sec-WebSocket-Version: 13
Upgrade: websocket
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36

Query:

protocol: 7
client: js
version: 4.3.1
flash: false

But in messages only one event:

{"event":"pusher:error","data":{"code":4005,"message":"Path not found"}}

Realtime event messages don't receive (((

It only get new notifications when the page refresh

Hi I followed all the steps and everything is ok, but it only get new notifications when the page refresh, I'm trying in my local environment , there is no errors, only those warnings :

Screenshot from 2019-11-21 12-05-20

Does anyone has any advice?

Invalid Date

image

Changing the following lines in NotificationMessage.vue component resolves the issue.

NotificationMessage.vue

// showing invalid date
fromNow (date) {
    return new moment.tz(date.date, 'YYYY-MM-DD HH:mm:ss', date.timezone).local().fromNow()
}

// working
      fromNow (date) {
            return new moment(date, 'YYYY-MM-DD HH:mm:ss').local().fromNow()
      }

Add translations

Is it possible to add the functionality so you can translate the string and time with json?

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.