我目前正在尝试将 html 更新推送到使用PubNub的用户的页面。我想将 html 代码推送给用户(这包括链接、引号、使 html 成为必需),并将其添加到用户表的末尾。
我目前正在尝试使用 api 发送消息,如下所示:
info = pubnub.publish({
'channel' : 'myChannel',
'message' : {
'some_text' : message
}
})
消息在哪里:
<div class="content">Message text here.<img src="image.gif" border="0" alt="" title="laugh out loud" class="inlineimg" /></div>
我的问题是当我尝试发送页面更新时收到以下消息:
</div> is not JSON serializable
我假设发生这种情况是因为我试图发送 html 代码?
关于如何解决这个问题/更好的方法来做到这一点的任何建议?这是我第一次尝试将消息“推送”到网页,所以我可能完全错了。