-
Notifications
You must be signed in to change notification settings - Fork 5
/
testing.html
72 lines (58 loc) · 2.01 KB
/
testing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<p align="center"><img src="./app/assets/images/leewaylogo2.png" width=250px/></p>
<h1 align="center">Leeway</h1>
<p align="center">
<a href="https://leewayapp.herokuapp.com/">Live Demo!</a>
</p>
<p align="center">
<a href="#technologies">Technologies</a> •
<a href="#key-features">Key Features</a> •
<a href="#pending-features">Pending Features</a>
</p>
<p align="center">A Slack clone implemented using a Rails backend and React/Redux frontend framework. Users can create channels or direct messages to converse with a single person or multiple people.</p>
<p align="center">Note: this project was designed and built under a two-week deadline.</p>
<p align="center"><img src="./app/assets/images/leewayfeatures.png" width=650px/></p>
## Technologies
- ActionCable 5.2.1
- React 16.4.2
- Redux 4.0.0
- npm 6.3.0
- Postgresql Database
## Key Features
#### Live Chat
Leeway utilizes ActionCable, a WebSocket framework for Rails, allowing open connections for real-time server communication.
On the backend, messages are broadcasted to all users who are subscribed to the specified channel:
```
#app/models/message.rb
after_create_commit do
ActionCable.server.broadcast "chat-#{messageable_id}:messages",
id: id,
body: body,
author_id: author_id,
author: author.format_username,
messageable_type: messageable_type,
timestamp: created_at.strftime("%-I:%M %p")
end
```
```
#app/assets/javascripts/channels/messages.js.erb
<% Channel.all.each do |channel| %>
App[`chat-${<%=channel.id%>}:messages`] = App.cable.subscriptions.create(
{channel: "MessagesChannel", messageable_id: <%=channel.id%>}, {
received: (data) => data
}
);
<% end %>
```
```app/channels/messages_channel.rb
#
def subscribed
stream_from "chat-#{params['messageable_id']}:messages"
end
```
#### Channel and Direct Message Creation
#### Message Editing and Deletion
## Pending Features
## Pending Features
- Channel/direct message editing and deletion
- Search for a channel or direct message chat
- Message search