Saturday, December 19, 2015

Chatting with Binary Web Sockets

This is a follow up article to Chatting with Web Sockets.
Since version 0.97 beta, PAW Server supports binary Web Sockets. Before that only text base Web Sockets were supported.

Binary Web Sockets have the benefit (as the name implies) that binary Blobs (Binary Large Objects) can be exchanged. That offers the possibility to exchange binary data. This blog post shows how to use binary Web Sockets to build a simple (multi-) media chat client by using these new capabilities.

Bellow is a screenshot of the new chat window which also allows to drag and drop (media) files to send them to connected clients. There are two drop areas, the button titled Drop / Select and the message output area. In addition files can be selected by pressing the Drop / Select button.

Chat Window

Supported file types depend on the used browser, but normally audio, video, text and html files should work.

The setup is almost identical to the one described inside the former post Chatting with Web Sockets.
Only the ZIP file including HTML/CSS and JavaScript files are different. You'll find a link to the ZIP file below that post.

So to make sure Web Sockets are setup correctly follow the following steps from the post Chatting with Web Sockets:
  1. Configuring the Web Socket Handler
  2. Web Socket Config File
  3. The BeanShell Script
After the configuration is finished, the only thing left is to extract the ZIP file into a folder (e.g. chat2) of your choice inside the [PAW_HOME]/html folder (usually /sdcard/paw) and to call that page from a browser.

You can now try to connect to the web page (e.g. http://<ip>:8080/chat2/) with multiple browsers and see if the chat is working.

Have fun and merry Xmas :)

Links


5 comments:

  1. Dear Sir

    Thank you so much for your work

    I am very like Paw Server in android

    And current i am using libs Paw Server in android

    But i have a small problem, could you please help me ?

    I see class PawServerActivity extends Activity

    could you please make a new class PawServerActivity extends AppCompatActivity
    or extends FragmentActivity

    Because AppCompatActivity support more features in android

    Please help me, Please

    Thank you so much

    Tran

    ReplyDelete
    Replies
    1. Adding the compat JARs to PAW would almost double the size of the APK. If you need AppCompat support please have a look at the AppCompatDelegate class.

      Delete
    2. Dear Jochen

      Thank you so much for your reply

      Yes, i see and i try with AppCompatDelegate, AppCompatDelegate only support some feature of toolbar, I can't add a tabbar in activity beacause android need getSupportFragmentManager() of AppCompatActivity and some feature need AppCompatActivity

      I know when Adding compat libs size of apk will double the size but current very more application support compat of android, please review this problem.

      Or could you please build 2 version lib for paw server
      1 version will support AppCompatActivity
      and 1 version will don't support Compat

      Please

      Thank you so much

      Tran

      Delete
    3. Hi Tran,

      will change PawServerActivity to extend AppCompat in a future PAW release. The OK button issue will also be fixed (strange that nobody reported that before).
      You can try if this is working for you with a new BuildOwnPawServer preview available here:

      https://goo.gl/5edHRq

      Hope this is working as expected.

      Bye
      Jochen

      Delete
    4. Dear Jochen

      I am really happy with your great work

      It's worked, thank you so much for your support

      And i using your app in play store, i am running in asus zend 2, android 5.0

      i see have some problem,
      1. Internal Storage and SDCard size the same,

      Internal Storage
      Total: 26145.02 Mbytes
      Free: 18690.22 Mbytes
      phoneSDCard
      Total: 26145.02 Mbytes
      Free: 18690.22 Mbytes

      2. when delete sms message, thread message don't work. i think can't delete in android 4.4+

      3. camera don't work, when i using feature camera it don't show anything.

      4. user interface not beautiful, you know user now like application have feature perfect and interface nice ui ...

      Again, thank you so much for your great work,

      Have a good time, Thanks

      Tran

      Delete

Note: Only a member of this blog may post a comment.