Strife is synonymous with Discord and also a clone of the existing application.
- Ruby on Rails
- PostgreSQL
- Redis
- ActionCable
- JavaScript/React + Redux
- CRUD for Servers
- Add users to servers
- CRUD for Channels
- Live messaging within Server Channels
- Create live DM's and Group DM's
ChannelChannel
def subscribed
@channel = Channel.find_by(id: params[:id])
stream_for @channel
end
this.CableApp.messages = this.CableApp.cable.subscriptions.create(
{
channel: "ChannelChannel",
id: this.props.channel.id,
},
{
received: (message) => {
this.getResponseMessage(message);
},
}
);
}
Action Cable creates a subscription which listens for new messages associated with the appopriate channel.
def create
@message = Message.new(message_params)
@channel = Channel.find(message_params['channel_id'])
if @message.save
ChannelChannel.broadcast_to(
@channel,
{ json: @message.to_json(include: :author) },
)
render json: @message.to_json(include: :author)
else
render json: @message.errors.full_messages, status: 422
end
end
When a new message is created it broadcasts the message to the appopriate channel and for users who are subscribed to the channel they will receive the message in real time.
- Users can create, edit and add members to servers and channels.