(2014/05/19 11:03), Satoshi Kobayashi wrote:
> 2014-05-16 5:21 GMT+09:00 FUJITA Tomonori <fujita.tomon...@lab.ntt.co.jp>:
> 
>> On Thu, 15 May 2014 13:30:53 +0900
>> Satoshi Kobayashi <satosh...@stratosphere.co.jp> wrote:
>>
>>>>>> +class SimpleSwitchWebSocketController(ControllerBase):
>>>>>> +    def __init__(self, req, link, data, **config):
>>>>>> +        super(SimpleSwitchWebSocketController, self).__init__(
>>>>>> +            req, link, data, **config)
>>>>>> +        self.simpl_switch_spp = data[simple_switch_instance_name]
>>>>>>
>>>>>
>>>>> Is this a typo?
>>>>> s/simpl_switch_spp/simple_switch_app/g
>>>>>
>>>> I followed Ryu-book's style.
>>>>
>> http://osrg.github.io/ryu-book/ja/html/rest_api.html#simpleswitchcontroller
>>>>
>>>> I don't know it is a typo or not...
>>>>
>>>
>>> Ah, I see. It is probably a typo.
>>
>> Surely, we had better to fix them.
>>
>>
>>>>>> +    def _websocket_handler(self, ws):
>>>>>> +        simple_switch = self.simpl_switch_spp
>>>>>> +        simple_switch.logger.debug('WebSocket connected: %s', ws)
>>>>>> +        while True:
>>>>>> +            data = simple_switch.ws_send_queue.get()
>>>>>> +            ws.send(unicode(json.dumps(data)))
>>>>>> +
>>>>>> +    @route('simpleswitch', url)
>>>>>> +    def websocket(self, req, **kwargs):
>>>>>> +        simple_switch = self.simpl_switch_spp
>>>>>> +        if simple_switch.ws_lock.acquire(blocking=False):
>>>>>>
>>>>>
>>>>> This is able to connect only a single client?
>>>>>
>>>> Yes.
>>>>
>>>> I think it is complex to handle multiple connection and broadcast data.
>>>> I want to keep simple this sample app.
>>>>
>>>
>>> >From my standpoint, this issue is caused by lack of method of
>>> notification. Currently, Ryu has API that react to the demand from
>> clients.
>>> However, the contrary does not exist. It will solve, if there is API
>> which
>>> can broadcast a message from application to clients. (This is not a
>> meaning
>>> that I want you to make it)
>>
>> Sounds useful. Do you have a patch?
>>
> 
> How about this? RFC.
> 
Great!

I wanted to implement such API.
And this works well on my environment.


------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to