On Thu, Apr 6, 2017 at 11:27 AM, Arshardh Ifthikar <arsha...@wso2.com>
wrote:

> Hi,
>
> The instance variables defined should not be an issue because a new
> instance of the handler is created for each Websocket connection [1]. But
> the tenantDomain variable should not be static.
>
> IMHO the issue should be that the uri parameter of the req object is set
> twice in line 109 and 124 of [2], hence the first change is overwritten.
>

Yes, issue was with URI, We have to convert tenant URI /t/
api.com/echowebsocket/1.0.0 to -t/api.com/echowebsocket/1.0.0 to mimic the
carbon-mediation as the request came from super tenant API.

But, Having tenantDomain as static variable will be a problem, if multiple
APIs from different tenants are invoked. I will fix it too.


>
>
> [1] https://github.com/wso2/carbon-mediation/blob/master/
> components/inbound-endpoints/org.wso2.carbon.inbound.
> endpoint/src/main/java/org/wso2/carbon/inbound/endpoint/
> protocol/websocket/InboundWebsocketChannelInitializer.java#L100
>
> [2] https://github.com/wso2/carbon-apimgt/blob/v6.1.66/compo
> nents/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/
> org/wso2/carbon/apimgt/gateway/handlers/WebsocketInboundHandler.java
> <https://github.com/wso2/carbon-apimgt/blob/v6.1.66/components/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/org/wso2/carbon/apimgt/gateway/handlers/WebsocketInboundHandler.java#L59>
>
> Thanks,
> Arshardh
>
> On Wed, Apr 5, 2017 at 2:11 PM, Abimaran Kugathasan <abima...@wso2.com>
> wrote:
>
>> Hi Isuru,
>>
>> Currently, WebSocket isn't working for any tenants.
>>
>> Seems, WebSocket uri, tenantDomain, etc are defined as static variables.
>> I guess this will be a cause for this problem.
>>
>> https://github.com/wso2/carbon-apimgt/blob/v6.1.66/component
>> s/apimgt/org.wso2.carbon.apimgt.gateway/src/main/java/
>> org/wso2/carbon/apimgt/gateway/handlers/WebsocketInboundHandler.java#L59
>>
>> On Wed, Mar 29, 2017 at 6:59 PM, Isuru Haththotuwa <isu...@wso2.com>
>> wrote:
>>
>>> Hi,
>>>
>>> This is a standalone APIM 2.1.0 setup.
>>>
>>> I have an API published by a tenant (a.com), and subscribed by another
>>> tenant (b.com). I'm using the sample netty based ws client from the
>>> docs [1].
>>>
>>> While invoking this API, error [2] can be sen in the APIM. Going through
>>> the code, noted that there is a check for 
>>> 'tenantDomain.equals(req.getUri())'
>>> at [3]. Down the line this causes the endpoint to be null for this
>>> particular tenant domain (a.com). This works for super tenant since the
>>> method getTenantDomainFromUrl actually returns the same url for super
>>> tenants.
>>>
>>> Any explanation for this logic? What am I doing wrong here?
>>>
>>> [1]. https://docs.wso2.com/display/AM210/Create+a+WebSocket+API
>>> [2]. ERROR - InboundWebsocketSourceHandler Endpoint not found for port
>>> : 9099 tenant domain : a.com
>>> [3]. https://github.com/wso2/carbon-mediation/blob/release-4.6.10
>>> /components/inbound-endpoints/org.wso2.carbon.inbound.endpoi
>>> nt/src/main/java/org/wso2/carbon/inbound/endpoint/protoc
>>> ol/websocket/InboundWebsocketSourceHandler.java#L160
>>>
>>> --
>>> Thanks and Regards,
>>>
>>> Isuru H.
>>> +94 716 358 048 <+94%2071%20635%208048>* <http://wso2.com/>*
>>>
>>>
>>>
>>> _______________________________________________
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks
>> Abimaran Kugathasan
>> Senior Software Engineer - API Technologies
>>
>> Email : abima...@wso2.com
>> Mobile : +94 773922820 <+94%2077%20392%202820>
>>
>> <http://stackoverflow.com/users/515034>
>> <http://lk.linkedin.com/in/abimaran>
>> <http://www.lkabimaran.blogspot.com/>  <https://github.com/abimarank>
>> <https://twitter.com/abimaran>
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> *Arshardh Ifthikar*
> Trainee Software Engineer
> WSO2, Inc.
> Mobile: +94719806525 <+94%2071%20980%206525>
>



-- 
Thanks
Abimaran Kugathasan
Senior Software Engineer - API Technologies

Email : abima...@wso2.com
Mobile : +94 773922820

<http://stackoverflow.com/users/515034>
<http://lk.linkedin.com/in/abimaran>  <http://www.lkabimaran.blogspot.com/>
<https://github.com/abimarank>  <https://twitter.com/abimaran>
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to