knowledgecode / WebSocket-for-Android

Cordova/PhoneGap plugin that makes WebSocket available on Android
Apache License 2.0
143 stars 53 forks source link

[Questions] Use it without phonegap. #12

Closed stereo720712 closed 10 years ago

stereo720712 commented 10 years ago

Excuse me, I hope can use it without phonegap , does it can do webview java injection? It's like this : https://github.com/anismiles/websocket-android-phonegap but it is not support RFC6455,I try to fix but not success, Can you help me ? Thank you & Appreciate .

knowledgecode commented 10 years ago

Of course It'll work if you'll write a bridge (Java-JavaScript Interface). What do you want me to do?

stereo720712 commented 10 years ago

Can you write a simple example briege about websocket webview client ? Thank you & Appreciate.

knowledgecode commented 10 years ago

Why do you hope to use this plugin without PhoneGap? Are you making a native Android app? If we make a bridge for this plugin, we might as well make PhoneGap. It's too much trouble, and we don't have many benefits. Do you allow to import PhoneGap(as a jar file) as part of your app?

stereo720712 commented 10 years ago

Yes, I am make a native Android app for my school lab test. I allow import PhoneGap,but it seems can't use myself webview?(instead by PhoneGap loadurl()). Sencond , I hope for the web page, it still can be like the html5 way.

Thank you and Appreciate .

knowledgecode commented 10 years ago

You are trying to make a "browser" that is capable of using WebSockets?

knowledgecode commented 10 years ago

I tried to make an example app: https://github.com/knowledgecode/example

This is an Eclipse project. Deploy files below www folder to your web server, and rewrite the 30th line of HelloCordova.java.

Tell me whether what you expected.

stereo720712 commented 10 years ago

Thank you , I will try to write my expected example for you . Afeter finished , I will post here . Thank you very much.

stereo720712 commented 10 years ago

https://www.dropbox.com/s/tlelvirb3gu9w1k/websocket%20server2-async.zip This is my android example ,I am try to write a websocket server and client in a native app,so I need a webview support websocket. (I use the koush/AndroidAsync for websocket Server,but fail in the websocket client now.) Does the phonegap have any different with the native webview or it's jsut a wrap? I am afraid use phonegap will have others affect in app.

knowledgecode commented 10 years ago

I tried to incorporate Cordova(PhoneGap) into your example. It seems to work. Since you seem concerned about to use PhoneGap, I give advice you before providing the source.

First, I'm not exactly sure what is the difference between PhoneGap WebView and native WebView, but if you use my plugin, you are better to use PhoneGap. Because I've made it as "PhoneGap plugin". Second, I'll support that you use my plugin, but If you plan to use other WebSocket plugin in your app, please ask those authors. ok?

Now, I can commit to recent example repository or send you it directly with email. Which one is more convenient for you?

stereo720712 commented 10 years ago

Thank you , I am try to using you code to set a webview , it's seems a good choice. I have try make a browser in the app, but it's too big. It can closed,Thank you very much.

stereo720712 commented 10 years ago

Sorry , I am now restart writing this test . I test your example for the www.websocket.org, but the page is fail to connect by websocket. May you help me to take a look ? Thank you .

knowledgecode commented 10 years ago

You have to connect to echo.websocket.org.