我可以在另一个有websocket服务器的项目中使用phoenix.js文件,还是那里有凤凰特有的代码?
https://github.com/phoenixframework/phoenix/blob/master/assets/js/phoenix.js
我正在查看javascript代码,我没有看到任何特定于凤凰框架的内容。
希望有更多经验的人可以对此有所了解。
答案 0 :(得分:0)
该代码似乎确实不是特定于Phoenix的,但您仍需要服务器代码来支持~$ curl -v "http://localhost:59202/file1.txt"
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 59202 (#0)
> GET /file1.txt HTTP/1.1
> Host: localhost:59202
> User-Agent: curl/7.58.0
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Wed, 28 Feb 2018 13:42:15 GMT
< Server: inets/6.4.5
< Content-Type: text/plain
< Etag: nCZT0114
< Content-Length: 14
< Last-Modified: Mon, 26 Feb 2018 02:51:52 GMT
<
Hello, world!
* Connection #0 to host localhost left intact
类中的所有/大多数功能,例如:渠道,主题,LongPoll传输,a心跳,在场信息。
我不知道这些概念和实现与其他websocket服务器相比有多标准化。