NOVELTY - The method comprises directing a raw syngas stream comprising carbon monoxide (CO), methane and hydrogen stream from an acid gas removal system to a CO and methane removal system for producing pure hydrogen stream and a stream comprising CO and methane, returning the CO and methane stream to a gasifier, and exporting the hydrogen stream as product. The syngas is produced in a hydrogen production unit from refinery residues consisting of petroleum coke, visbreaker tar, pitch from deasphalting processes, vacuum residues, atmospheric residues and coal.    USE - The method is useful for recovering hydrogen and methane from syngas of a gasifier.    ADVANTAGE - The method is capable of economically recovering the high purity hydrogen and methane from syngas of the gasifier.    DETAILED DESCRIPTION - The method comprises directing a raw syngas stream comprising carbon monoxide (CO), methane and hydrogen stream from an acid gas removal system to a CO and methane removal system for producing pure hydrogen stream and a stream comprising CO and methane, returning the CO and methane stream to a gasifier, and exporting the hydrogen stream as product. The syngas is produced in a hydrogen production unit from refinery residues consisting of petroleum coke, visbreaker tar, pitch from deasphalting processes, vacuum residues, atmospheric residues and coal. The CO and methane removal system comprises temperature swing adsorption unit, and an indirect heat exchanger that exchanges heat between the raw syngas prior to entry into the acid gas removal system and the product hydrogen stream after exiting the temperature swing adsorption unit. The raw syngas stream exiting the acid gas removal system is at a temperature of -40 degrees C to -60 degrees C, and the raw syngas enters the temperature swing adsorption unit at a temperature of -40 degrees C to -60 degrees C. The product hydrogen stream has less than 1 ppmv of carbon monoxide, and a purity of 99-99.99%.    DESCRIPTION OF DRAWING(S) - The diagram shows a schematic view of a cryogenic carbon monoxide and methane removal system.    Residual fuels (301)    Gasifier reactor (304)    Raw syngas (305)    Shift converter (306)    Carbon dioxide. (310)