【发布时间】:2015-12-21 18:59:08
【问题描述】:
我正在学习 erlang,我尝试了这个项目 - https://github.com/hcs42/cowboy_tutorial_webchat。
我使用
构建它./rebar compile generate skip-deps=true && rel/chat/bin/chat console
在 LAMP 的情况下,如果我要更改 .js 文件,我只会重新加载页面并应用新的更改。
对于这个 erlang 项目,每次我更改 .js 文件中的某些内容时,我都必须重新编译并使用 rebat 生成。为什么会这样?
另外,如果我查看 JS 实现,消息是使用发送的
socket.send(message);
并在服务器端接收为:
websocket_handle({text, Msg}, Req, State) ->
{reply, {text, << "You said: ", Msg/binary >>}, Req, State};
如果cowboy 接受{text,Msg},Req,State 但客户端只发送文本,这是如何工作的?客户端也永远不会收到{reply,{text,YouSaid...},而只会收到纯文本消息?
【问题讨论】:
标签: javascript erlang cowboy