美文网首页
rails6 Actionable websocket环境搭建(

rails6 Actionable websocket环境搭建(

作者: 夕阳下的不回头 | 来源:发表于2020-12-06 21:14 被阅读0次

首先保证rails项目已经创建好了
然后进入该项目的根目录
1、输入 rails g channel chat
建立一个名为chat的channel 这个功能是rails提供的

image.png

2、输入yarn add jquery 安装jquery


image.png

3、rails webpacker:install 安装webpacker


image.png

环境搭建完毕

下面介绍rails项目中的配置文件(未完待续)
首先修改 ./app/channel/chat_channel.rb
增加一行stream_from "chat_channel"
这是要广播的channel


image.png

相关文章

网友评论

      本文标题:rails6 Actionable websocket环境搭建(

      本文链接:https://www.haomeiwen.com/subject/kvmowktx.html