You're viewing old version number 15. - Current version

2 min

Simple chat web app for Toledo Talk

Update Feb 28, 2014: created and tested initially within the testcode area at soupmode.com on Feb 25-27, and then merged into ToledoTalk.com code base on Feb 27-28. Still need to correct double post issue on my HP tablet that uses WebOS, and need to correct the IEv8 issue of nothing posted when hitting the return key.

"Chat" may be the incorrect term.

Details:

  • web-based app.
  • text input field to enter message is located at the top of the site like a microblog and not at the bottom like in traditional chat or message apps.
  • post button next to text input field but hitting the return key will also submit message.
  • messages are displayed in reverse order, which is youngest to oldest.
  • for now, zero formatting in the messages. even raw urls won't be transformed into a clickable link.
  • limit message size to 200 to 300 characters.
  • display message as a paragraph block.
  • the client-side javascript will poll the server every 15 to 30 seconds.
  • display the most recent 50 or so messages.
  • for each message block, show:
    • author name
    • message text
    • created date
  • database table fields
    • message_id - auto increment
    • message_text
    • author_name
    • author_id
    • created_date
    • status
    • ip_address
  • no joins
  • select ... order by id desc limit 50
  • server-side script returns only a blob of json that the client-side javascript parses for browser display.
  • display the page without the normal ToledoTalk.com header or nav bar.
  • the messages will display at the default normal width of Toledo Talk's content.
  • responsive design:
    • adjust the text input field length accordingly.
    • adjust the font size of the messages.

ToledoTalk.com

  • JRS / Error.pm
  • JRS / StrNumUtils.pm
  • / minified.js
  • chat.html
  • message2.pl
  • ttchat-messages.sql
  • Parula / Chat.pm
  • tmpl / chat.tmpl

Description at TT

Barebones chat app, assembled from scraps of code that I found laying around. A post is limited to 300 characters with no formatting. It uses client-side JavaScript to post and display messages. The most recent 150 posts are displayed in reverse order, youngest to oldest.

JavaScript refreshes the page every 20 seconds. If you are logged in, you can refresh sooner by hitting the return key or tapping the post button. If you are not logged in, you can refresh sooner by tapping the refresh button.

It seems to work fine in the Chrome, Opera, and Firefox browsers and on the iPad. For IEv8, a post does not get submitted when the return key is hit. Until I correct this for IEv8, need to tap the post button to submit a message. Anyway, it's not fully tested in all browsers and devices.

Testing

  • Chrome - works
  • Firefox - works
  • Opera - works
  • does not work in Opera Mini on my old flip phone. i'm not surprised.
  • IE v8 - works when posting by tapping the post button, but nothing is posted when hitting the return key.
  • HP tablet with WebOS - works fine when tapping the post button, but when hitting the return key on the tablet screen, it double-posts.
  • iphone ?
  • Samsung S4 ?

#toledotalk - #chat - #messaging

From JR's : articles
503 words - 2984 chars - 2 min read
created on
updated on - #
source - versions

Related articles
Simple chat web app for Toledo Talk - Mar 02, 2014
TT-Chat - Mar 03, 2014



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Dec 22, 2024 - 10:28 a.m. EST