33 : m_defaultPort(defaultPort)
37 shared_ptr<WebSocketChannel>
40 shared_ptr<WebSocketChannel> channel = findChannel(endpoint);
41 if (static_cast<bool>(channel))
44 channel = make_shared<WebSocketChannel>(endpoint);
45 m_channels[endpoint] = channel;
50 shared_ptr<WebSocketChannel>
54 websocket::Endpoint endpoint(address::from_string(localIp), boost::lexical_cast<uint16_t>(port));
58 shared_ptr<WebSocketChannel>
62 if (i != m_channels.end())
65 return shared_ptr<WebSocketChannel>();
74 BOOST_THROW_EXCEPTION(
Error(
"WebSocketFactory does not support 'createFace' operation"));
77 std::list<shared_ptr<const Channel> >
80 std::list<shared_ptr<const Channel> > channels;
81 for (ChannelMap::const_iterator i = m_channels.begin(); i != m_channels.end(); ++i)
83 channels.push_back(i->second);
function< void(const std::string &reason)> FaceConnectFailedCallback
Prototype for the callback that is called when face is failed to get created.
represents the underlying protocol and address used by a Face
shared_ptr< WebSocketChannel > createChannel(const websocket::Endpoint &localEndpoint)
Create WebSocket-based channel using websocket::Endpoint.
Exception of WebSocketFactory.
Table::const_iterator iterator
Copyright (c) 2011-2015 Regents of the University of California.
virtual std::list< shared_ptr< const Channel > > getChannels() const
virtual void createFace(const FaceUri &uri, ndn::nfd::FacePersistency persistency, const FaceCreatedCallback &onCreated, const FaceConnectFailedCallback &onConnectFailed) 1
Try to create Face using the supplied FaceUri.
WebSocketFactory(const std::string &defaultPort)
function< void(const shared_ptr< Face > &newFace)> FaceCreatedCallback
Prototype for the callback called when face is created (as a response to incoming connection or after...
boost::asio::ip::tcp::endpoint Endpoint