Giter VIP home page Giter VIP logo

messenger-app-vuejs-and-laravel's People

Contributors

afikderi 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

messenger-app-vuejs-and-laravel's Issues

No application encryption key has been specified.

C:\xampp\htdocs\Messenger-App-VueJS-and-Laravel-master\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php
// want to make sure to convert them back to the raw bytes before encrypting.
if (Str::startsWith($key = $this->key($config), 'base64:')) {
$key = base64_decode(substr($key, 7));
}

        return new Encrypter($key, $config['cipher']);
    });
}

/**
 * Extract the encryption key from the given configuration.
 *
 * @param  array  $config
 * @return string
 */
protected function key(array $config)
{
    return tap($config['key'], function ($key) {
        if (empty($key)) {
            throw new RuntimeException(
                'No application encryption key has been specified.'
            );
        }
    });
}

}

Arguments
"No application encryption key has been specified."

Fatal error: Trait 'Illuminate\Foundation\Events\Dispatchable' not found in C:\xampp\htdocs\chat-app\app\Events\NewMessage.php on line 14

Using Pusher on Laravel 5.8 generates this error on NewMessage Event file.
Steps I took to try and debug:

  1. tried removing the line "use Dispatchable, InteractsWithSockets, SerializesModels;" inside the Class;

  2. tried without using the Classes at the top of the file

none of those worked. On Laravel 5.8 Documentation they don't mention using this line inside our Event Classes, maybe it's outdated?!

File looks like this:

`<?php

namespace StyxEminus\Events;
use StyxEminus\Message;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class NewMessage implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public $message;

/**
 * Create a new event instance.
 *
 * @return void
 */
public function __construct(Message $message)
{
    $this->message = $message;
}

/**
 * Get the channels the event should broadcast on.
 *
 * @return \Illuminate\Broadcasting\Channel|array
 */
public function broadcastOn()
{
    return new PrivateChannel('messages.' . $this->message->to);
}

public function broadcastWith() {
    return ["message" => $this->message];
}

}
`

Local Server: Apache on Xampp;
Operating System: W10 64bit
Browser: Brave(chromium) & Chrome

Edit: added specs of environment

Illuminate\Broadcasting\BroadcastException 404 NOT FOUND

i follow all step as you (youtube ep02) but i have this error
image
my code:
NewMessage.php
`namespace App\Events;
use App\Message;
use Illuminate\Broadcasting\Channel;
use Illuminate\Queue\SerializesModels;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;

class NewMessage implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;

public $message;

public function __construct(Message $message)
{
    $this->message = $message;
}

public function broadcastOn()
{
    return new PrivateChannel('messages.' . $this->message->to);
}

public function broadcastWith()
{        
    return ["message" => $this->message];
}

}`

ContactsController.php
`namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
use App\Message;
use App\Events\NewMessage;

class ContactsController extends Controller
{
public function get()
{
$contacts = User::where('id', '!=', auth()->id())->get();
return response()->json($contacts);
}

public function getMessagesFor($id)
{
    $messages = Message::where('from', $id)->orWhere('to', $id)->get();
    return response()->json($messages);
}

public function send(Request $request)
{
    $message = Message::create([
        'from' => auth()->id(),
        'to' => $request->contact_id,
        'text' => $request->text
    ]);
    broadcast(new NewMessage($message));
    return response()->json($message);
}

}`

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

Real time message

Hi Thanks in advance,

Real time message is not working,i am getting the message after refresh the page only.

Not receiving messages in Real-Time after deployment.

I’m not receiving messages from others in Real-Time after deploying the chat app to Heroku — unless I click a contact twice.
Is the problem a bug in the code or in heroku? Or how would you deploy this on a live server?

Unread messages

Hello :)
first you did really great job.

However i have one issue. Even i am chatting with somebody messages are still as unread.

Any ideas what is wrong ?

Two PUSHER apps?

Dear @AfikDeri, first of all, thanks for the tutorial. You are a great teacher.
My app is running like a breeze but the problem is that I already have a pusher app to send notifications.
As I thought, the chat is using those keys to send and receive and this is NOT cool, right?
Ok, I´ve created another app with its own keys. But how to set them up on '.env' file?

I saw this section at '.env' file, but don´t know where to create a MIX pusher app key

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 

Any hints?

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.