跳到主要内容

Ruby发送 - PubSub (Websocket)

本节内容为Ruby实现GoEasy Rest接口发送消息, 使用时,可参阅Rest接口的详细介绍

Ruby

require 'net/http'

# 新加坡rest-host:rest-singapore.goeasy.io
url = "https://rest-hz.goeasy.io/v2/pubsub/publish"
appkey = "您的appkey"
channel = "test_channel"
content = "Hello, GoEasy!"
response = Net::HTTP.post_form(URI(url), {appkey: appkey, channel: channel, content: content})
puts response.code

REST Host

杭州: rest-hz.goeasy.io
新加坡: rest-singapore.goeasy.io

本页目录: