I change this line : var wsUri = "ws://dns-host:81/";
with this line: var wsUri = "ws://" + location.host + ":81/";
and now I can connect to websocket server with local ip address from local network ,
also through public ip/ dns-host when I am on public network.
Thanks a lot for help