Permalink
Browse files

websocket, break: deprecated ws.connect.

  • Loading branch information...
xicilion committed Oct 28, 2017
1 parent 44e7657 commit 5e90fb993b8d6de778605c2769462e808d96f374
View
@@ -535,7 +535,6 @@
<ClCompile Include="src\websocket\WebSocket.cpp" />
<ClCompile Include="src\websocket\WebSocketHandler.cpp" />
<ClCompile Include="src\websocket\WebSocketMessage.cpp" />
<ClCompile Include="src\websocket\ws.cpp" />
<ClCompile Include="src\xml\XmlAttr.cpp" />
<ClCompile Include="src\xml\XmlCDATASection.cpp" />
<ClCompile Include="src\xml\XmlComment.cpp" />
@@ -1433,9 +1433,6 @@
<ClCompile Include="src\websocket\WebSocketMessage.cpp">
<Filter>Source Files\websocket</Filter>
</ClCompile>
<ClCompile Include="src\websocket\ws.cpp">
<Filter>Source Files\websocket</Filter>
</ClCompile>
<ClCompile Include="src\xml\XmlAttr.cpp">
<Filter>Source Files\xml</Filter>
</ClCompile>
View
@@ -535,7 +535,6 @@
<ClCompile Include="src\websocket\WebSocket.cpp" />
<ClCompile Include="src\websocket\WebSocketHandler.cpp" />
<ClCompile Include="src\websocket\WebSocketMessage.cpp" />
<ClCompile Include="src\websocket\ws.cpp" />
<ClCompile Include="src\xml\XmlAttr.cpp" />
<ClCompile Include="src\xml\XmlCDATASection.cpp" />
<ClCompile Include="src\xml\XmlComment.cpp" />
@@ -1433,9 +1433,6 @@
<ClCompile Include="src\websocket\WebSocketMessage.cpp">
<Filter>Source Files\websocket</Filter>
</ClCompile>
<ClCompile Include="src\websocket\ws.cpp">
<Filter>Source Files\websocket</Filter>
</ClCompile>
<ClCompile Include="src\xml\XmlAttr.cpp">
<Filter>Source Files\xml</Filter>
</ClCompile>
View
@@ -18,7 +18,6 @@ namespace fibjs {
class WebSocketMessage_base;
class WebSocket_base;
class Stream_base;
class Handler_base;
class ws_base : public object_base {
@@ -40,7 +39,6 @@ class ws_base : public object_base {
public:
// ws_base
static result_t connect(exlib::string url, exlib::string origin, obj_ptr<Stream_base>& retVal, AsyncEvent* ac);
static result_t upgrade(v8::Local<v8::Function> accept, obj_ptr<Handler_base>& retVal);
public:
@@ -65,25 +63,18 @@ class ws_base : public object_base {
static void s_get_OPEN(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_CLOSING(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_get_CLOSED(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void s_connect(const v8::FunctionCallbackInfo<v8::Value>& args);
static void s_upgrade(const v8::FunctionCallbackInfo<v8::Value>& args);
public:
ASYNC_STATICVALUE3(ws_base, connect, exlib::string, exlib::string, obj_ptr<Stream_base>);
};
}
#include "WebSocketMessage.h"
#include "WebSocket.h"
#include "Stream.h"
#include "Handler.h"
namespace fibjs {
inline ClassInfo& ws_base::class_info()
{
static ClassData::ClassMethod s_method[] = {
{ "connect", s_connect, true },
{ "connectSync", s_connect, true },
{ "upgrade", s_upgrade, true }
};
@@ -195,27 +186,6 @@ inline void ws_base::s_get_CLOSED(v8::Local<v8::String> property, const v8::Prop
METHOD_RETURN();
}
inline void ws_base::s_connect(const v8::FunctionCallbackInfo<v8::Value>& args)
{
obj_ptr<Stream_base> vr;
METHOD_NAME("ws.connect");
METHOD_ENTER();
ASYNC_METHOD_OVER(2, 1);
ARG(exlib::string, 0);
OPT_ARG(exlib::string, 1, "");
if (!cb.IsEmpty()) {
acb_connect(v0, v1, cb);
hr = CALL_RETURN_NULL;
} else
hr = ac_connect(v0, v1, vr);
METHOD_RETURN();
}
inline void ws_base::s_upgrade(const v8::FunctionCallbackInfo<v8::Value>& args)
{
obj_ptr<Handler_base> vr;
@@ -20,6 +20,8 @@
namespace fibjs {
DECLARE_MODULE(ws);
class asyncSend : public AsyncState {
public:
asyncSend(WebSocket* pThis, exlib::string data, int32_t type = ws_base::_TEXT)
View

This file was deleted.

Oops, something went wrong.
View
@@ -44,13 +44,6 @@ module ws
/*! @brief WebSocket 对象,参见 WebSocket */
static WebSocket new Socket();
/*! @brief 创建一个 websocket 连接,并返回握手成功的 Stream 对象
@param url 指定连接的 url,支持 ws:// 和 wss:// 协议
@param origin 指定连接的授权域名
@return 返回连接成功的 Stream 对象,可能为 Socket 或者 SslSocket
*/
static Stream connect(String url, String origin = "") async;
/*! @brief 创建一个 websocket 协议处理器,从 http 接收 upgrade 请求并握手,生成 WebSocket 对象
@param accept 连接成功处理函数,参数为 WebSocket 对象
@return 返回协议处理器,可与 HttpServer, Chain, Routing 等对接

0 comments on commit 5e90fb9

Please sign in to comment.