3

I am writing a WebApp which needs access to a TCP socket. This can be achieved by creating a chrome app and putting it on the web store. I am fine with that, but I want that my app is also accessible through an url. Is this possible? I don't want a user need to install my app in order to use it.

if it is not possible. Is there a means of accessing a TCP socket in a webApp?

lethal-guitar
  • 4,438
  • 1
  • 20
  • 40
Giuseppe Pes
  • 7,772
  • 3
  • 52
  • 90
  • Maybe Websockets (http://en.wikipedia.org/wiki/WebSocket) might be helpful? Also I think `socket.io` is not the right tag here, as it is a specific library. – lethal-guitar Oct 17 '13 at 21:01
  • 2
    You can't access raw TCP from browser. But you can open WebSocket which is close enough. You can also use Flash or some long polling mechanism (depending on what you are trying to achieve). – freakish Oct 17 '13 at 21:04
  • I don't want web socket, i need TCP socket. – Giuseppe Pes Oct 17 '13 at 21:09
  • 2
    @GiuseppePes Then the answer is "no". Case closed. However if you explain what you are trying to achieve it might turn out that websockets is enough (and most likely it is). – freakish Oct 17 '13 at 21:09
  • I need to connect a server on the port 7000. is it this possible? I have no access to the server and it does not support http. – Giuseppe Pes Oct 17 '13 at 21:44
  • 1
    Well no, WebSockets work only on port 80. If you are determined to access that server from a pure web app, you might consider placing a wrapper service on a server you control, which accesses the target server and provides the data over HTTP – lethal-guitar Oct 17 '13 at 21:50
  • i can access from either Chrome or Firefox App though. – Giuseppe Pes Oct 17 '13 at 21:55
  • 2
    @lethal-guitar WebSockets work on any port since HTTP does. Port 80 is just a default port. Giuseppe, if your server does not support neither HTTP nor Flash then you **can't** access it from browser unless you write your custom plugin. – freakish Oct 18 '13 at 06:21
  • what do you mean for custom plugin? – Giuseppe Pes Oct 18 '13 at 07:35
  • 1
    @GiuseppePes I think he's talking about your "Chrome App", which is technically kind of like a browser plugin. – lethal-guitar Oct 18 '13 at 12:26

1 Answers1

0

Yes... but No. See that question : What is the syntax to do a cross-domain XMLHTTPREQUEST to an FTP server?

Workaround: use a Chrome App whith chrome.sockets as a proxy between your web page and the TCP service (as stated by @freakish and @lethal-guitar in the comments above).

Community
  • 1
  • 1
Supersharp
  • 29,002
  • 9
  • 92
  • 134