Code Monkey home page Code Monkey logo

laravel-chat's Introduction

laravel-chat

Build a chat app with Laravel, Vue.js and Pusher. Follow the tutorial https://pusher.com/tutorials/chat-laravel

Getting Started

Clone the project repository by running the command below if you use SSH

git clone [email protected]:ammezie/laravel-chat.git

If you use https, use this instead

git clone https://github.com/ammezie/laravel-chat.git

After cloning,run:

composer install

Duplicate .env.example and rename it .env

Then run:

php artisan key:generate

Prerequisites

Setup Pusher

If you don't have one already, create a free Pusher account at https://pusher.com/signup then login to your dashboard and create an app.

Set the BROADCAST_DRIVER in your .env file to pusher:

BROADCAST_DRIVER=pusher

Then fill in your Pusher app credentials in your .env file:

PUSHER_APP_ID=xxxxxx
PUSHER_APP_KEY=xxxxxxxxxxxxxxxxxxxx
PUSHER_APP_SECRET=xxxxxxxxxxxxxxxxxxxx
PUSHER_APP_CLUSTER=

Database Migrations

Be sure to fill in your database details in your .env file before running the migrations:

php artisan migrate

And finally, start the application:

php artisan serve

and visit http://localhost:8000/ to see the application in action.

Built With

  • Pusher - APIs to enable devs building realtime features
  • Laravel - The PHP Framework For Web Artisans
  • Vue.js - The Progressive JavaScript Framework

Acknowledgments

laravel-chat's People

Contributors

ammezie avatar tranminhtam003 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

laravel-chat's Issues

Hi i am newbie to pusher facing the issue

i am using laravel 5.5 version
and need to implement chat feature in it.
i got to know pusher can help so i installed the package in my app
now i am facing a issue is my laravel app is using angular for frontend
and it is getting conflict with vue.
<div class="row cs-row"> <div id="app"> <div class="container" style="width: 500px !important"> <div class="row"> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading">Chats</div> <div class="panel-body"> <chat-messages :messages="messages"></chat-messages> </div> <div class="panel-footer"> <chat-form v-on:messagesent="addMessage" :user="{{ Auth::user()->username }}" ></chat-form> </div> </div> </div> </div> </div> </div> </div>
this is my view

but not loading chat form only a blank box occurring there
blank chat boc

require js

FatalErrorException in helpers.php line 532: Method App\User::__toString() must not throw an exception, caught Illuminate\Database\Eloquent\JsonEncodingException: Error encoding model [App\User] with ID [2] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.

FatalErrorException in helpers.php line 532:
Method App\User::__toString() must not throw an exception, caught Illuminate\Database\Eloquent\JsonEncodingException: Error encoding model [App\User] with ID [2] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.

Error when sending message.

Hello. i am getting this issue when i type and send a message. have no idea why. please help me with this.

app.js:11168 Uncaught (in promise) Error: Request failed with status code 500
    at createError (app.js:11168)
    at settle (app.js:11723)
    at XMLHttpRequest.handleLoad

this is the preview from the console:
default

how can i solve this?
Thanks.

Class 'Pusher' not found

copy from guthub
composer install
change .env with key from pushser website
when i command php artisan seve there is error

[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Pusher' not found

Problem in chating in your code

laravel chat
laravel chat 1

hello,
i have download the your and succesfully on the system.But it not working on chating functionality.
i have registred two user but first user not show the second user chat.And how first user chat to second user. how first user send the message to second .i have also attachemnt the screenshot. pls slove this problem......

addMessage error

I have vue components setup and all is good but sending the message I get this error:

screen shot 2018-08-11 at 16 22 08

Any reason for this?

Messaginig system work but not in real time

Hey,

The chat application works fine, user can see each other message but only when they refresh their page.
It supposes to work in real-time without refresh the page, Please suggest.

Realtime not working

After message send destination side have to refresh tab not auto load chat like proper chat functionality. how to set auto refresh chat body.

Do I need an npm run dev command?

Even configured I still have this error: Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4001,"message":"App key a1eb60abd7e12aee27f9 not in this cluster. Did you forget to specify the cluster?"}}} but I did not use the command npm run dev, do I need to compile everything again?

Passing another var?

Love this! It works beautifully.

I've tried and can't figure out how pass another var, including the user id.

I want to have a room ID added with the message and user id.

Any ideas?

App to work

In file .env need to change 'BROADCAST_DRIVER=log' to 'BROADCAST_DRIVER=pusher'
worked for me!

View wont show up ,pls helpp!!

so i try to move your chat project to my project, and when the chat is displayed its only showing up like this
image

i already add everything, from app.blade until chat.blade.php
can you please help

It's working well, but I need help with scrolling to bottom

I would like to say that this chat application is great, and I learned a lot by following the tutorial from the blog. However, I'd like to know if anyone has an idea to automatically scroll the chat-messages div to the bottom when a new message is sent/received.

I'm still new to vue.js, and even jQuery.

Pushthis Implementation

I have created a Pusher clone and charging 50% less as Pusher is ridiculously expensive; Just about into beta for it. Wondering if I can do a pull request and add in my Laravel package to this once the beta is live.

My package doesn't use Laravel broadcasting, so you can send data from a controller, trait or an event!

Use Pushthis\Pushthis;

$pushthis->send([
            'channel' => 'example-channel',
            'event' => 'example-event',
            'data' => [
                'message' => 'Hello World'
            ]
        ]);


.env
PUSHTHIS_KEY
PUSHTHIS_SECRET
PUSHTHIS_NETWORK

Need help

Hi mister i'm back for another problem.
In my chat i would like to add a column in message table to add the receiver id, so i'll be able the make a conversation with only two guys.
The problem is i'm not famillar with vue yet and need to insert this receiver_id in the message table.
In the route get this id now how to insert it in the table with vue it's my proble.
Thank to help very import it's the last thing i need .
Sincerly yours.

database

hello thanks for this project but i need a database for this project

Specific user to chat.

Do the system able to chat from user a to user b or user c? How do I do that? etc; from::($user) to::($recipient)

WebSocketError

Hello,

After following all the steps carefully when I try to run the script, I am getting below error :

  1. WebSocket connection to 'wss://ws-eu.pusher.com/app/b7e6ef323a6a2820eec1?protocol=7&client=js&version=4.0.0&flash=false' failed: Invalid frame header
  2. app.js:33139 Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":1006}}}
  3. WebSocket connection to 'wss://ws-eu.pusher.com/app/b7e6ef323a6a2820eec1?protocol=7&client=js&version=4.0.0&flash=false' failed: WebSocket is closed before the connection is established.
  4. Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4001,"message":"Did you forget to specify the cluster when creating the Pusher instance? App key b7e6ef323a6a2820eec1 does not exist in this cluster."}}}

I have created so many times new API just to check if I am not making any mistake related to API.

Please help me in that.

Thanks,
Ali

Pusher is not defined after upgrade

Hi,

I managed to run your application by following the steps:

$ git clone https://github.com/ammezie/laravel-chat
$ composer install
$ cp .env.example .env
$ vim .env
$ php artisan key:generate
$ php artisan migrate
$ yarn
$ yarn run dev
$ php artisan serve

And up to this point, everything works fine and I get live updates when messages are sent. However, if I then try to modify it, i.e. by running yarn upgrade or even just doing yarn add moment (as an example) the whole thing breaks and I get an error message saying Pusher is not defined.

Do you have any idea why this might be happening or how I can resolve it?
Thanks

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.