File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed
Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change 1717import websocket
1818import threading
1919from threading import Thread , Event
20+ import base64
21+ import zlib
2022
2123# Global Default Variables
2224hostname = '172.20.33.30'
@@ -75,10 +77,24 @@ def processUpdate(ws, message_json):
7577 frag_num = fields_data ["FRAG_NUM" ]
7678 guid = fields_data ["GUID" ]
7779 mrn_src = fields_data ["MRN_SRC" ]
78- tot_size = fields_data ["TOT_SIZE" ]
79-
80- # if frag_num > 1: # We are now processing more than one part of an envelope - retrieve the current details
81- # i = 0
80+ tot_size = int (fields_data ["TOT_SIZE" ])
81+ try :
82+ fragment_decoded = base64 .b64decode (fragment )
83+ print ("GUID = %s" % guid )
84+ print ("TOT_SIZE = %d" % tot_size )
85+ print ("fragment length = %d" % len (fragment_decoded ))
86+ # if frag_num > 1: # We are now processing more than one part of an envelope - retrieve the current details
87+
88+ if tot_size == len (fragment_decoded ): # Completed News
89+ decompressed_data = zlib .decompress (
90+ fragment_decoded , zlib .MAX_WBITS | 32 )
91+ print ("News = %s" % decompressed_data )
92+ else :
93+ print ("Multiple Fragments!!" )
94+ except zlib .error as error :
95+ print (error )
96+ except :
97+ print ("Error!!!" )
8298
8399
84100def processStatus (ws , message_json ):
You can’t perform that action at this time.
0 commit comments