Giter Site home page Giter Site logo

chat-demo's Introduction

chat-demo

This is a simple demo application for https://github.com/musonza/chat/

chat

  1. Clone this repo
  2. composer install
  3. cp .env.example .env
  4. Create database and modify .env
  5. php artisan migrate
  6. php artisan key:generate
  7. npm install && npm run dev
  8. php artisan serve
  9. Create 2 user accounts in different browsers and start chatting

To use Pusher

You need to comment this out

location.reload(); // comment this out if you are broadcasting
Remove this comment

chat-demo's People

Contributors

dependabot[bot] avatar lakhbawa avatar mateo2181 avatar musonza avatar tomonorisatoh 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

chat-demo's Issues

participanttransformer.php error where user id not found

I was experiencing an error when one of the chat_part messageable_id was not found in user_id so it made an participanttransformer.php error.

I hope there will be an improvement to check whether the participants in the users are there or not, so they don't make mistakes

thanks

issue while installing composer

Warning: Ambiguous class resolution, "Illuminate\Database\Eloquent\Factory" was found 2x: in "/Users/ammadkhan/Docs/chat-demo-master/vendor/laravel/legacy-factories/src/Factory.php" and "/Users/ammadkhan/Docs/chat-demo-master/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factory.php", the first will be used.
Warning: Ambiguous class resolution, "Illuminate\Database\Eloquent\FactoryBuilder" was found 2x: in "/Users/ammadkhan/Docs/chat-demo-master/vendor/laravel/legacy-factories/src/FactoryBuilder.php" and "/Users/ammadkhan/Docs/chat-demo-master/vendor/laravel/framework/src/Illuminate/Database/Eloquent/FactoryBuilder.php", the first will be used.
Warning: Ambiguous class resolution, "Illuminate\Support\Traits\Macroable" was found 2x: in "/Users/ammadkhan/Docs/chat-demo-master/vendor/illuminate/macroable/Traits/Macroable.php" and "/Users/ammadkhan/Docs/chat-demo-master/vendor/laravel/framework/src/Illuminate/Support/Traits/Macroable.php", the first will be used.

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi

In PackageManifest.php line 122:

Undefined index: name

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

Issue with pusher, again

I follow the above instruction horaceho@0e99f41 and re-run the demo.

Pusher is connected:

Screen 2020-02-14 at 10 52 18

However, new message only shows up after manual refresh page (pressing Cmd-R, 1 & 2 are shown), the new message (e.g. enter 3 and click Send) does not show up in own window:

Screen 2020-02-14 at 10 54 01

or remote window:

Screen 2020-02-14 at 10 54 03

Any suggestion?

Originally posted by @horaceho in #15 (comment)

Issue with pusher

Hi Musonza,

Tried to implement pusher with the project.
Though pusher detects message passing. but it's not real-time in the app.
Any idea how to fix it?

node install problem

npm ERR! gyp verb download contents checksum {"node-v20.11.1-headers.tar.gz":"0aa42c91b441e945ff43bd3a837759c58b436de57dcd033d02e5cbcd2fba1f87"}
npm ERR! gyp verb validating download checksum for node-v20.11.1-headers.tar.gz (0aa42c91b441e945ff43bd3a837759c58b436de57dcd033d02e5cbcd2fba1f87 == 0aa42c91b441e945ff43bd3a837759c58b436de57dcd033d02e5cbcd2fba1f87)
npm ERR! gyp verb get node dir target node version installed: 20.11.1
npm ERR! gyp verb build dir attempting to create "build" dir: /home/web/musonza/chat-demo/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /home/web/musonza/chat-demo/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /home/web/musonza/chat-demo/node_modules/node-sass/build/config.gypi
npm ERR! gyp verb config.gypi checking for gypi file: /home/web/musonza/chat-demo/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /home/web/musonza/chat-demo/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/web/musonza/chat-demo/node_modules/node-sass/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/web/musonza/chat-demo/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/web/.node-gyp/20.11.1/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/web/.node-gyp/20.11.1',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/web/musonza/chat-demo/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/web/.node-gyp/20.11.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/web/musonza/chat-demo/node_modules/node-sass',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/gyp_main.py", line 16, in <module>
npm ERR!     sys.exit(gyp.script_main())
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 545, in script_main
npm ERR!     return main(sys.argv[1:])
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 538, in main
npm ERR!     return gyp_main(args)
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 514, in gyp_main
npm ERR!     options.duplicate_basename_check)
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 130, in Load
npm ERR!     params['parallel'], params['root_targets'])
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2783, in Load
npm ERR!     variables, includes, depth, check, True)
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 399, in LoadTargetBuildFile
npm ERR!     includes, True, check)
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 271, in LoadOneBuildFile
npm ERR!     aux_data, includes, check)
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 308, in LoadBuildFileIncludesIntoDict
npm ERR!     LoadOneBuildFile(include, data, aux_data, None, False, check),
npm ERR!   File "/home/web/musonza/chat-demo/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 251, in LoadOneBuildFile
npm ERR!     None)
npm ERR!   File "/home/web/.node-gyp/20.11.1/include/node/common.gypi", line 1
npm ERR!     incremental linking
npm ERR!                       ^
npm ERR! SyntaxError: invalid syntax
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/home/web/musonza/chat-demo/node_modules/node-gyp/lib/configure.js:345:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Linux 5.10.0-28-amd64
npm ERR! gyp ERR! command "/usr/local/bin/node" "/home/web/musonza/chat-demo/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /home/web/musonza/chat-demo/node_modules/node-sass
npm ERR! gyp ERR! node -v v20.11.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

how to solve this problem?

Demo currently in broken state

Liked the look of the chat package, so checked out this demo app, but it's current status is not usable.

Running migrations gives a

Symfony\Component\Debug\Exception\FatalErrorException  :
Cannot declare class CreateChatTables, because the name is already in use at
/chat-demo/database/migrations/2019_11_06_134235_create_chat_tables.php:104

Seems this is because there's two migration files currently in the repo:
2019_10_31_015755_create_chat_tables.php & 2019_11_06_134235_create_chat_tables.php

Removing one makes stuff work, but only briefly, loging in you can't start a new conversation as /routes 404's (see #12 )

Brief look through the history and reverting to commit #bdc8748 seemed to solve many of these issues - and while it might not be the latest and greatest way of using the package, it does let me see what the package does out of the box!

I appreciate what you're trying to do here, and love having a demo app to examine how packages are used, but wonder if having a more defined develop branch you can work on to showcase all features and a slower (tested 100% working branch) for people who just want to try it out and see if they like the look of it before diving deeper?

Semantic Errors. when joining the chat

HTTP422: UNPROCESSABLE ENTITY - The request was well-formed but could not be processed due to semantic errors. (XHR)POST - http://127.0.0.1:8000/chat/conversations/17/participants

`joinConversation: function joinConversation(id) {
            var payload = {
                'participants': [{
                    'id': window.participant && window.participant.id,
                    'type': window.participant && window.participant.type
                }]
            };

            axios.post("/chat/conversations/" + id + "/participants", payload).then(function (response) {
                window.location.href = "chat?conversation_id=" + id;
            });`

The controller is same. As i faced it few people said i need to pass the right value . I did everything right.
But still can't figure out what is causing it.
I would really appreciate the help.
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.