请问这俩函数是干啥用的?看了半天文档没搞清楚用途。 Doc http://edgeapi.rubyonrails.org/classes/ActionCable/Channel/Streams.html#method-i-stream_for
class CommentsChannel < ApplicationCable::Channel
def follow(data)
stream_from "comments_for_#{data['recording_id']}"
end
def unfollow
stop_all_streams
end
end
class CommentsChannel < ApplicationCable::Channel
def subscribed
post = Post.find(params[:id])
stream_for post
end
end