You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+63-2Lines changed: 63 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,8 @@
1
1
# Laravel-Talk
2
2
3
-
Talk is a Laravel 5 based user conversation (inbox) system. You can easily integrate this package with any Laravel based project. It helps you to develop a messaging system in just few mins. Here is a project screenshot that was developed by Talk.
3
+
Talk is a Laravel 5 based user conversation (inbox) system with realtime messaging. You can easily integrate this package with any Laravel based project. It helps you to develop a messaging system in just few mins. Here is a project screenshot that was developed by Talk.
4
+
5
+
> Talk v2.1.0 is supported realtime messaging. Learn more about [Talk Live Messaging](https://github.com/nahid/talk#realtime-messaging)
4
6
5
7
> Talk v2.0.0 just released. Do not migrate 1.1.7 to v2.0.0 directly. Please try our [sample project](https://github.com/nahid/talk-example) first and then apply it on your project.
6
8
@@ -23,6 +25,7 @@ So let's start your tour :)
23
25
### Features
24
26
25
27
* Head to head messaging
28
+
* Realtime messaging
26
29
* Creating new conversation
27
30
* Message threads with latest one
28
31
* View conversations by user id or conversation id
@@ -73,7 +76,16 @@ Okay, now you need to configure your user model for Talk. Go to `config/talk.php
73
76
```php
74
77
return [
75
78
'user' => [
76
-
'model' => 'User\Model'
79
+
'model' => 'App\User'
80
+
],
81
+
'broadcast' => [
82
+
'enable' => false,
83
+
'app_name' => 'your-app-name',
84
+
'pusher' => [
85
+
'app_id' => '',
86
+
'app_key' => '',
87
+
'app_secret' => ''
88
+
]
77
89
]
78
90
];
79
91
```
@@ -462,6 +474,55 @@ This method is used to permanently delete all conversations
462
474
boolean deleteConversations($conversationId)
463
475
```
464
476
477
+
## Realtime Messaging
478
+
479
+
Talk also support realtime messaging thats called Talk-Live. Talk use pusher for realtime message. So first you have to configure pusher. Go to `app/talk.php` again and configure.
480
+
481
+
```php
482
+
return [
483
+
'user' => [
484
+
'model' => 'App\User'
485
+
],
486
+
'broadcast' => [
487
+
'enable' => false,
488
+
'app_name' => 'your-app-name',
489
+
'pusher' => [
490
+
'app_id' => '',
491
+
'app_key' => '',
492
+
'app_secret' => ''
493
+
]
494
+
]
495
+
];
496
+
```
497
+
498
+
in this new version broadcast section was added with talk config. Here broadcast is disabled by default.
499
+
If you want to enable live(realtime) messaging then you have to enable it first. Then add pusher credentials. Thats it. Everytime
500
+
when you send message then talk will automatically fire two event, one for specific user and second for specific conversation. So
501
+
you may listen or subscribe one or both as per your wish. Finally you have to subscribe these events by using `talk_live()` helper function.
502
+
Go to where you want to subscribe to work with message data follow this code.
`talk_live()` is support one parameters as array. The first parameter is for channel name which you want to subscribe. You have not know which channel was broadcast.
517
+
Talk broadcast two channel by default. One for user and second for conversation. If you want to subscribe channel for currently loggedin user then you have to pass
518
+
519
+
logedin user id in 'user' key. `['user'=>['id'=>auth()->user()->id, 'callback'=[]]` or you want to subscribe for conversation id you have pass conversation id as
520
+
'conversation' key. `['conversation'=>['id'=>$conversationID, 'callback'=>[]]`. You may pass both if you wants.
521
+
522
+
You can pass a callback for working with pusher recieved data. For both `user` and `conversation` section support callbacks as array. So you can pass multiple callback as array value that was show in previous example.
523
+
524
+
You can watch [Talk-Live-Demo](https://youtu.be/bN3s_LbObnQ)
0 commit comments